akhauriyash/Code-Regression huggingface dataset:
import sys

def UpSolve():
    while True:
        H,W = map(int ,raw_input().split())
        if [H,W] == [0,0]:
            return
        else:
            solve(H,W)


def solve(H,W):
#    H,W = map( int,raw_input().split())
#    if [H,W] == [0,0]:
#        return
#    print H,W
    dmap = [ [[i,j,"",False]  for i in range(W) ] for j in range(H)]
#    print dmap
    #read data
    for j  in range(H):
        line = raw_input()
        for i in range(W):
            dmap[j][i][2] = line[i]
#    print dmap
#    print "########"
    #end read data
    #travel
    tx,ty = 0,0
#    while dmap[ty][tx][3] is not True:
    while True:
#        print tx,ty,dmap[ty][tx][2],dmap[ty][tx][3]
#        print "--"
        dmap[ty][tx][3] = True
        if dmap[ty][tx][2] == "<":
            tx -= 1
        elif dmap[ty][tx][2] == ">":
            tx += 1
        elif dmap[ty][tx][2] == "v":
            ty += 1
        elif dmap[ty][tx][2] == "^":
            ty -= 1
        elif dmap[ty][tx][2] == ".":
            print tx,ty
            return
        if dmap[ty][tx][3] is True:
            print "LOOP"
            return
    
if __name__ == "__main__":
    UpSolve()

Measured memory_bytes: 5472
import numpy as np
n = int(input())
h = list(map(int,input().split()))
dp=[np.inf]*n
dp[0]=0
for i in range(1,n):
  dp[i] = min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
  if i > 1:
    dp[i] = min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])

Measured memory_bytes: 22700
#include<bits/stdc++.h>
using namespace std;
#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pii> >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>M;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
const int mod=1e9+7;
const int sze=1e5+2;
const int inf= (int)(1e19+10LL);
void solve()
{
  int n;
  sl(n);
  int sum=0;
  for(int i=1;i<=n;i++){
	  if(!(i%3==0 || i%5==0))sum+=i;
  }
  cout<<sum<<endl;

		
}
 
signed main(){
   int test=1;
   //sl(test);
   while(test--){
      solve();
 
   }
  return 0;
}


Measured memory_bytes: 3632
n = int(input())
a = [int(x) for x in input().split()]
ans = 'No'
for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 4
    elif a[i] % 2 == 0:
        a[i] = 2
    else:
        a[i] = 1

if a.count(2) != 0:
    if a.count(4) >= a.count(1):
        ans = 'Yes'
else:
    if a.count(4) + 1 >= a.count(1):
        ans = 'Yes'
print(ans)


Measured memory_bytes: 14252
#include<stdio.h>

int main(){

int m,n;

int ma=0;
int x=0;
scanf("%d%d",&m,&n);

for(int i=0;i<m;i++){int s=0;
for(int j=0;j<n;j++)
{scanf("%d",&x);s+=x;}
if(s>ma)ma=s;
}

printf("%d\n",ma);

return 0;
}

Measured memory_bytes: 1032
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <map>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <memory>

using namespace std;

#if 1
#define PRINT(x) { cout << #x << ": " << (x) << endl; }
#define PRINT_CONTAINER(x)  { cout << #x << ": ";                       \
        for (size_t ix = 0; ix < (x).size(); ++ix) cout << (x)[ix] << ", "; \
        cout << endl; }
#else
#define PRINT(x)
#define PRINT_CONTAINER(x)
#endif

typedef pair<int, int> p;

int n, d, x;

int main(int argc, char *argv[]) {
    scanf("%d", &n);
    scanf("%d %d", &d, &x);
    for (int i = 0; i < n; ++i) {
        int a;
        scanf("%d", &a);
        x += 1 + (d - 1) / a;
    }
    printf("%d\n", x);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool binary(vector<int> S,int n, int key) {
    int left = 0;
    int right = n;
    int mid;
    while(left < right) {
        mid = (left+right)/2;
        if(S.at(mid) == key) {
            return true;
        }
        else if(key < S.at(mid)) {
            right = mid;
        }
        else {
            left = mid + 1;
        }
    }
    return false;
}
int main() {
    int n,q;
    
    cin >> n;
    vector<int> S(n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &S.at(i));
    }
    
    cin >> q;
    vector<int> T(q);
    for(int i = 0; i < q; i++) {
        scanf("%d", &T.at(i));
    }
    
    int sum = 0;
    for(int i = 0; i < q; i++) {
        if(binary(S,n,T.at(i))) sum++;
    }
    
    printf("%d\n",sum);
    
}


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

using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef pair<ll, ll> PL;

const int N = 123456;
ll a[N];
VI edges[N];


ll dfs(int v, int par) {
  vector<ll> pool;
  ll tot = 0;
  rep(i, edges[v].size()) {
    int w = edges[v][i];
    if (w == par) { continue; }
    ll sub = dfs(w, v);
    if (sub < 0) {
      return -1;
    }
    pool.push_back(sub);
    tot += sub;
  }
  ll rest = 0;
  if (par == -1) {
    if (pool.size() >= 2 && tot != 2 * a[v]) {
      return -1;
    }
    if (pool.size() == 1 && tot != a[v]) {
      return -1;
    }
  } else {
    rest = pool.size() >= 1 ? 2 * a[v] - tot : a[v];
    if (rest < 0) {
      return -1;
    }
    pool.push_back(rest);
  }
  sort(pool.rbegin(), pool.rend());
  if (pool.size() >= 2 && pool[0] > a[v]) {
    return -1;
  }
  if (pool.size() == 1) {
    if (pool[0] != a[v]) {
      return -1;
    }
    return a[v];
  }
  return rest;
}

int main(void) {
  int n;
  cin >> n;
  rep(i, n) {
    cin >> a[i];
  }
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  ll result = dfs(0, -1);
  cout << (result >= 0 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 19072
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const int mo = 1e9 + 7;
typedef long long ll;
string s;
void solve()
{
    for(int i=1;i<(1<<4);i++)
    {
        string S;
        S+=s[0];
        int sum=S[0]-'0';
        for(int j=1;j<4;j++)
        {
            if((i>>j)&1)S+="+",sum+=s[j]-'0';
            else S+="-",sum-=s[j]-'0';
            S+=s[j];
        }
        if(sum==7)
        {
            cout<<S<<"=7"<<endl;
            return;
        }
    }
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>s;
    solve();
    return 0;
}

Measured memory_bytes: 256
N = input()
if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
    print("hon")
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8':
    print("pon")
else:
    print("bon")

Measured memory_bytes: 9116
#include <bits/stdc++.h>
#define all(x) (x).begin() , (x).end()
#define rall(x) (x).rbegin() , (x).rend()
#define fi first
#define se second
#define pb push_back
#define read(type, ...)type __VA_ARGS__; macro_scan(__VA_ARGS__);

using namespace std;

template<typename T> void macro_scan(T& t){cin>>t;};
template<typename F, typename ...R>void macro_scan(F& f , R& ...r){
  cin>>f;macro_scan(r...);
}

void deb(){
    cerr<<endl;
}
template<typename T , typename... t>
void deb(T a , t...b){
    cerr<<a<<" ";
    deb(b...);
}
template<typename T>
void dev(vector<T>v){
    int c = 0;
    for(auto i : v){
        cerr<<i<<" ";
        c++;
    }
    cerr<<endl;
}
const int N = 1e5 + 2;
const int M = 1e9 + 7;
string s;
int dp[N][13];


void add_self(int &a , int b , int Mod){
    a += b;
    if(a >= Mod){
        a -= Mod;
    }
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //int t; cin>>t;for(;t--;)done();
    cin>>s;
    int n = s.size();
    dp[0][0] = 1;
    for(int i = 1 ; i <= n; ++i){
        for(int j = 0 ; j < 13; ++j){
            if(s[i-1]=='?'){
                for(int k = 0 ; k < 10; ++k){
                   add_self( dp[i][(j * 10 + k)%13] , dp[i - 1][j] , M);
                }
            }else{
                add_self(dp[i][(j*10 + s[i - 1] - '0')%13] , dp[i - 1][j] , M);
            }
        }
    }
    cout<<dp[n][5]<<"\n";

}




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

int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;
  string R(1,'R');
  string G(1,'G');
  string B(1,'B');
  
  unsigned int c,cm;
  vector<int> r(0),g(0),b(0);
  for(int i=0;i<N;i++){
    if(S[i]==R[0]){
      r.push_back(i);
      //cout<<i<<" "<<r.back()<<endl;
    }
    else if(S[i]==G[0]) g.push_back(i);
    else b.push_back(i);
  }
  int rs,gs,bs;
  rs = r.size();
  gs = g.size();
  bs = b.size();
  int n1,n2,n12;
  int ca1,ca3;

  c = rs*gs*bs;
  cm = 0;
  for(int i=0;i<rs;++i){
    for(int j=0;j<gs;++j){
      if(r[i]<g[j]){
        n1 = r[i];
        n2 = g[j];
      }else{
        n2 = r[i];
        n1 = g[j];
      }
      n12 = n2-n1;
      ca1 = n1-n12;
      ca3 = n2+n12;
      if(n12%2==0 && S[n1+n12/2]==B[0]) cm = cm+1;
      if(ca1>=0 && S[ca1]==B[0]) cm = cm+1;
      if(ca3<N && S[ca3]==B[0]) cm = cm+1;
      
    }
  }

  
  cout<<c-cm<<endl;

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef pair<double,int>Q;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int a,b,c;
string rec(int x,int y,int z,string X,string Y,string Z){
	if(x==0&&y==0&&z==0) return "";
	if(x==0&&y==0) return rec(z,0,0,Z,"","");
	if(x==0) return rec(y,z,0,Y,Z,"");
	if(y==0&&z==0){
		string ret="";
		rep(i,x) ret += X;
		return ret;
	}
	if(z==0) return rec(x,z,y,X,Z,Y);
	if(x >= z){
		return rec(x-z,z,y,X,X+Z,Y);
	}
	else{
		return rec(x,y,z-x,X+Z,Y,Z);
	}
}
int main(){
	cin >> a >> b >> c;
	cout << rec(a,b,c,"a","b","c") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#define ll long long
using namespace std;

int main(){
    ll n, number;
    cin >> n;
    map<ll, ll > way;
    for(int i = 1; i <= n; i++) {
        cin >> number;
        way.insert(make_pair(i, number));
    }
    ll ct = 0, num = 1;
    while(ct <= n) {
        num = way[num];
        ct++;
        if(num == 2) break;
    }
    if(num == 2) cout << ct << endl;
    else cout << -1 << endl;
    return 0;
}

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

int main(){
	vector<vector<vector<string> > > s01(101, vector<vector<string> >(101, vector<string>(2, "2")));
	s01[0][0][1] = "";
	for(int i=0; i<100; ++i){
		for(int j=0; j<=i; ++j){
			if(s01[j][i-j][0] != "2"){
				s01[j+1][i-j][1] = min(s01[j+1][i-j][1], '0' + s01[j][i-j][0]);
				s01[j][i-j+1][1] = min(s01[j][i-j+1][1], '1' + s01[j][i-j][0]);
			}
			if(s01[j][i-j][1] != "2"){
				s01[j+1][i-j][0] = min(s01[j+1][i-j][0], '0' + s01[j][i-j][1]);
				s01[j][i-j+1][1] = min(s01[j][i-j+1][1], '1' + s01[j][i-j][1]);
			}
		}
	}

    int n;
    cin >> n;
    vector<int> a;
	int zero = 0;
	int one = 0;
    for(int i=0; i<n; ++i){
		int b;
		cin >> b;
		if(b == 0)
			++ zero;
		else if(b == 1)
			++ one;
		else
			a.push_back(b);
	}
	sort(a.begin(), a.end());
	n -= zero + one;

	string s = s01[zero][one][1];
	int change = -1;
	if(s == "2"){
		if(n > 0){
			s = s01[zero][one+1][1];
			change = a[0];
			a.erase(a.begin());
			-- n;
		}else{
			s = s01[zero][one][0];
		}
	}

    if(n >= 2 && a[n-2] == 2 && a[n-1] == 3)
		swap(a[n-2], a[n-1]);

	for(int i=0; i<n; ++i)
		cout << a[i] << endl;

	for(unsigned i=0; i<s.size(); ++i){
		if(s[i] == '1' && change != -1){
			cout << change << endl;
			change = -1;
		}else{
			cout << s[i] << endl;
		}
	}

    return 0;
}

Measured memory_bytes: 0
fun main(args: Array<String>) {
    val (N, K) = listOfInt()
    val H = listOfLong().sorted()
    val sum = H.sum()
    if (N <= K) {
        println(0)
        return
    }
    val ans = H.subList(0, N - K).sum()
    println(ans)
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)

Measured memory_bytes: 85324
def f(x):
    if x%2==0:
        res=x//2
    else:
        res=3*x+1
    return res



s=int(input())
a=[s]
for i in range(1,1000001):
    if f(a[i-1]) in a:
        print(i+1)
        break
    a.append(f(a[i-1]))

Measured memory_bytes: 8940
#include <iostream>
#include <cmath>
using namespace std;
int a[60];
int b[60];
int c[60];
int d[60];
int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        a[i] = tmp1;
        b[i] = tmp2;
    }
    for (int i = 0; i < m; i++) {
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        c[i] = tmp1;
        d[i] = tmp2;
    }
    for (int i = 0; i < n; i++) {
        int mindis = 1145141919;
        int minnum = -1;
        for (int j = 0; j < m; j++) {
            int dis = abs(c[j] - a[i]) + abs(d[j] - b[i]);
            if (mindis > dis) {
                mindis = dis;
                minnum = j;
            }
        }
        cout << (minnum + 1) << endl;
    }
}


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

int main() {
  int n,ans;
  bool flag;
  long long cnt=0;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  if (v[0] == 1) cout << "-1" << endl;
  else {
    ans = v[0];
    while (true) {
      cnt++;
      if (ans == 2) {
        cout << cnt << endl;
        break;
      }
      else if (cnt >= n) {
       cout << "-1" << endl;
        break;
      }
      else {
        ans = v[ans-1];
      }
    }
  }
}

Measured memory_bytes: 3796
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <math.h>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <map>

#define ll long long int 
#define MAX 7368791

using namespace std;

int main(void)
{
	bool year[MAX];
	int i;
	int n, m;
	int count = 0;
	int ye = 0;
	vector <int> ans;
	int j;





	while (1) {

		for (i = 0; i < MAX; i++) {
			year[i] = false;
		}



		cin >> m >> n;
		if (m == 0 && n == 0) {
			break;
		}


		for (i = m; ; i++) {

			if (year[i] == false) {
				if (n == 0) {
					ans.push_back(i);
					break;
				}
				n--;
				for (j = i; j < MAX; j = j + i) {
					year[j] = true;
				}

			}

		}


	}

	for (i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}
	

	return (0);
}

Measured memory_bytes: 10328
import numpy as np
N = int(input())
A = np.zeros((N,2))
for i in range(N):
    A[i] =  np.array(list(map(int,input().split())))

B = A[np.argsort(A[:,1])]
x = 0
for i in range(N):
    x += B[i,0]
    y = B[i,1]
    if x > y:
        print('No')
        break
    else:
        if i == N-1:
            print('Yes')
            break
            

Measured memory_bytes: 20280
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		String t = sc.nextLine();
		String S = "";
		String T = "";
		char[] chars = new char[s.length()]; 
		char[] chart = new char[t.length()]; 
		for (int i = 0; i < s.length(); i++) chars[i] = s.charAt(i);
		for (int i = 0; i < t.length(); i++) chart[i] = t.charAt(i);

		Arrays.sort(chars);
		Arrays.sort(chart);
		
		for (int i = 0; i < s.length(); i++) S += chars[i];
		for (int i = 0; i < t.length(); i++) T += chart[t.length() - i - 1];
		String ans = "No";
		if (S.compareTo(T) < 0) ans = "Yes"; 
		
		System.out.println(ans);
	}

}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
ll a,b,c,k,ans;
int main(){
	cin>>a>>b>>c>>k;
	if(a>k) ans+=k,k=0;
	else ans+=a,k-=a;
	if(k>=b) k-=b;
	if(k>0) ans-=k;
	cout<<ans;
    return 0;
}

Measured memory_bytes: 3644
import java.util.HashSet;
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        
        int N = scanner.nextInt();
        String s;

        HashSet<String> list = new HashSet<String>(N);

        for(int i = 0; i < N; i++){
            s = scanner.next();
            list.add(s);
        }

        System.out.println(list.size());
    }
}

Measured memory_bytes: 76840
n, q = gets.split.map(&:to_i)
queue = []

n.times{
	name, time = gets.chomp.split
	queue << [name, time.to_i]
}

total = 0
until queue.empty?
	task = queue.shift
	if task[1] > q
		total += q
		queue.push [task[0], task[1] - q]
	else
		total += task[1]
		puts "#{task[0]} #{total}"
	end
end

Measured memory_bytes: 19844
a,t,h,s=1e9,id,i;
main()
{
	scanf("%*d%d%d",&t,&a);
	t=(t-a)*1000;
	for(;i++,~scanf("%d",&h);)
	{
		h*=6;
		if(abs(t-h)<s)
		{
			s=abs(t-h);
			id=i;
		}
	}
	printf("%d",id);
}

Measured memory_bytes: 128
unittest
{
	assert( [ "2 4", "0 3" ].parse.expand.solve == 7 );
	assert( [ "2 4", "0 5" ].parse.expand.solve == 8 );
	assert( [ "4 1000000000", "0 1000 1000000 1000000000" ].parse.expand.solve == 2000000000 );
	assert( [ "1 1", "0" ].parse.expand.solve == 1 );
	assert( [ "9 10", "0 3 5 7 100 110 200 300 311" ].parse.expand.solve == 67 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nt = input.front.split.to!( long[] );
	input.popFront;
	auto ts = input.front.split.to!( long[] );
	return tuple( nt[ 1 ], ts );
}

auto solve( long t, long[] ts )
{
	auto r = 0L;
	for( auto i = 1L; i < ts.length; i++ )
	{
		r += min( t, ts[ i ] - ts[ i - 1 ] );
	}
	r += t;		// 最後に押された分
	return r;
}


Measured memory_bytes: 11224
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define for1(i,n) for(int i=1;i<=(int)(n);i++)
#define debug(x) cout << '>' << #x << ':' << x << endl;
const int MOD = 1e9 + 7 ;
int mpow(int a,int b,int p=MOD){  a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int n;
      cin>>n;
      int a[n];
      multiset<int> s;
      for(int i=0;i<n;i++)
      {
            cin>>a[i];
            s.insert(a[i]);
      }
      for(int i=0;i<n;i++)
      {
            s.erase(s.find(a[i]));
            auto x=s.end();
            x--;
            cout<<(*x)<<"\n";
            s.insert(a[i]);
      }
      
}
// I never lose. I either win or I learn

Measured memory_bytes: 12544
n,m=map(int,input().split())
g=[ [0 for _ in range(50)] for _ in range(50)]
a=[0]*m
b=[0]*m
for i in range(m):
    a[i],b[i]=map(lambda x:int(x)-1,input().split())
    g[a[i]][b[i]]=1
    g[b[i]][a[i]]=1
ans=0
#print(g)
for i in range(m):
#    print(i,end=' start i \n')
    g[a[i]][b[i]]=0
    g[b[i]][a[i]]=0
    vis=[0]*n
    def dfs(u):
        vis[u]=1
#        print(u,end=' dfs\n')
        for j in range(n):
            if j!=u and g[u][j]==1 and vis[j]==0:
                dfs(j)
    bridge=False
    dfs(0)
    for j in range(n):
        #print(i,vis)
        if vis[j]==0:
            bridge=True
    if bridge:
        ans+=1
    #print(i,end=' curr i \n')
    g[a[i]][b[i]]=1
    g[b[i]][a[i]]=1
print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int INF=2000000000;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> G(n);
  vector<P> vp;
  vector<int> used(n);
  for(int i=0; i<n-1; i++){
    int a,b;
    cin >> a >> b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
    vp.push_back(P(a,b));
  }
  queue<int> q;
  q.push(0);
  used[0]=1;
  map<P,int> mp;
  int K=0;
  while(!q.empty()){
    int v=q.front();
    q.pop();
    if(K<G[v].size()) K=G[v].size();
    int cur=1,ng=0;
    for(auto u:G[v]){
      if(used[u]) ng=mp[P(v,u)];
    }
    for(auto u:G[v]){
      if(used[u]) continue;
      if(cur==ng) cur++;
      mp[P(v,u)]=mp[P(u,v)]=cur;
      cur++;
      q.push(u);
      used[u]=1;
    }
  }
  cout << K << endl;
  for(auto p:vp){
    cout << mp[p] << endl;
  }
}

Measured memory_bytes: 19700
#include <bits/stdc++.h>
#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=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=1e5+10;
const int INF=1e9+7;

int N;
int a[MAX][3];
void input(){
    cin>>N;
	rep1(i,N)rep(j,3)cin>>a[i][j];
}

int dp[MAX][3];
void solve(){
	rep1(i,N){
		dp[i][0]=max(dp[i-1][1], dp[i-1][2])+a[i][0];
		dp[i][1]=max(dp[i-1][2], dp[i-1][0])+a[i][1];
		dp[i][2]=max(dp[i-1][0], dp[i-1][1])+a[i][2];
	}
}

void output(){
  cout<<max(dp[N][0], max(dp[N][1], dp[N][2]));
}

int main(){
  input();
  solve();
  output();
}

Measured memory_bytes: 2560
//A
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x;
	cin >> x;
	if(x <= 599)cout << 8;
	else if(x >= 600 and x <= 799)cout << 7;
	else if(x <= 999)cout << 6;
	else if(x <= 1199)cout << 5;
	else if(x <= 1399)cout << 4;
	else if(x <= 1599)cout << 3;
	else if(x <= 1799)cout << 2;
	else cout << 1;
	return 0;
}


Measured memory_bytes: 3656
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int n;
	cin>>n;
	vector<int> d(n);
	rep(i, n) cin>>d[i];
	rep(i, n) d[i]--;
	int res = 0;
	rep(i, n) if(i!=d[i] && d[d[i]]==i) res++;
	res /= 2;
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 640
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, m) = (v[0], v[1]);
    let mut enable = vec![true; n + 1];
    for _ in 0..m {
        let a = read::<usize>();
        enable[a - 1] = false;
    }
    let big_int = 1000000007i64;
    let mut dp = vec![0i64; n + 1];
    dp[0] = 1;
    for i in 1..n + 1 {
        if enable[i - 1] {
            dp[i] += dp[i - 1];
            dp[i] %= big_int;
            if i > 1 {
                dp[i] += dp[i - 2];
                dp[i] %= big_int;
            }
        }
    }
    println!("{}", dp[n]);
}

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()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORr(i, k, n) for(int i = (k); i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORr(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

int main(void){
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  sort(ALL(a));
  REP(i, n-1){
    if(a[i] == a[i+1]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

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

using namespace std;

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	string s;
	s=to_string(a)+to_string(b)+to_string(c);
	int sum = stoi(s);
	if(sum%4==0)puts("YES");
	else puts("NO");
	return 0;
}

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

const int nmax=8;
bool graph[nmax][nmax];

int dfs(int v,int n,bool visited[nmax]){
  bool all_visited = true;

  for(int i=0;i<n;i++){
    if(visited[i]==false) all_visited=false;
  }

  if(all_visited) return 1;

  int ret=0;

  for(int i=0;i<n;i++){
    if(graph[v][i]==false) continue;
    if(visited[i]) continue;

    visited[i]=true;
    ret+=dfs(i,n,visited);
    visited[i]=false;
  }
return ret;
}


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

  for(int i=0;i<m;i++){
    int a,b;cin>>a>>b;
    graph[a-1][b-1] = graph[b-1][a-1] = true;
  }

  bool visited[nmax];
  for(int i=0;i<n;i++){
    visited[i]=false;
  }

  visited[0]=true;
  cout << dfs(0,n,visited) << endl;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

long long a[50];

int main() {
    int n = 50, i, j;
    long long k;
    
    scanf("%lld", &k);
    
    if (k < n) {
        for (i = 0; i < k; i++) a[i] = n;
    } else {
        for (i = 0; i < n; i++) a[i] = n + k / n - 1;
        
        k %= 50;
        
        for (i = 0; i < k; i++) {
            for (j = 0; j < n; j++) {
                if (i == j) {
                    a[j] += n;
                } else {
                    a[j]--;
                }
            }
        }
    }
    
    printf("%d\n", n);
    for (i = 0; i < n; i++) {
        if (i > 0) putchar(' ');
        printf("%lld", a[i]);
    }
    puts("");
    
    return 0;
}


Measured memory_bytes: 128
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;
#[allow(dead_code)]
const MOD:i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{n:usize, q:usize, s:chars, seg:[(usize,usize);q]};

    let mut csum = vec![0;n+1];
    for i in 0..n-1 {
        csum[i+1] = csum[i];
        if s[i] == 'A' && s[i+1] == 'C' { csum[i+1] += 1; }
    }
    csum[n] = csum[n-1];
    //debug!(csum);


    for i in 0..q {
        let l = seg[i].0;
        let r = seg[i].1;
        //debug!(l,r);
        println!("{}", csum[r-1]-csum[l-1]);
    }

}

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

using namespace std;

class Solver{
public:
    explicit Solver(int N_) : N(N_), odd(0), even(0) {
        for (int i = 0; i < N; ++i) {
            int a;
            cin >> a;
            (a % 2 == 0 ? even : odd)++;
        }
    }

    constexpr static int ipow(int x, int y) {
        int n = 1;
        for (int i = 0; i < y; ++i) {
            n *= x;
        }
        return n;
    }

    int solve() {
        return ipow(3, N) - ipow(2, even);
    }

public:
    int N;

    int odd;
    int even;
};

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

    Solver solver{N};
    cout << solver.solve() << endl;

    return 0;
}


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

#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second
#define mset(a, b) memset(a, b, sizeof(a))
#define DBG(x) cout << "[" << #x << "]: " << x << endl
using ll = long long;
using pii = pair<int, int>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif

template<class Ty> Ty randint(Ty a, Ty b) { return uniform_int_distribution<Ty>(a, b)(rng); }
template<class num> inline void rd(num& x) {
	char c, neg = 0; while(isspace(c = getchar_unlocked()));
	if(!isdigit(c)) neg = (c == '-'), x = 0;
	else x = c - '0';
	while(isdigit(c = getchar_unlocked())) x = (x << 3) + (x << 1) + c - '0';
	x = neg ? -x : x; }
template <class... Args> inline void rd(Args&... args) { (rd(args), ...); }

const int MAXN = 2e5 + 5, INF = 0x3f3f3f3f;

int par[MAXN];
int qtt[MAXN];

int find(int x) {
	if (x == par[x]) return x;
	return par[x] = find(par[x]);
}

int merge(int u, int v) {
	u = find(u), v = find(v);
	if (u == v) return 0;
	qtt[v] += qtt[u];
	par[u] = v;
	return qtt[v];
}

int main() {
	int n, m; rd(n, m);
	for (int i = 1; i <= n; i++) par[i] = i;
	for (int i = 1; i <= n; i++) qtt[i] = 1;

	int ans = 1;
	while(m--) {
		int a, b; rd(a, b);
		ans = max(ans, merge(a, b));
	}

	printf("%d\n", ans);
}

Measured memory_bytes: 5260
s = input()

n = len(s)
s1 = s[:n//2]
s2 = s[-(n//2):]
# print(s1)
# print(s2)

s3 = list()
for i in reversed(range(len(s2))):
    s3.append(s2[i])
s3 = ''.join(s3)
s2 = s3
cnt = 0

for i in range(len(s1)):
    if s1[i] != s2[i]:
        cnt += 1
print(cnt)

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

int main() {
    int n;
    cin >> n;
    if (n == 1) {
        cout << "Yes\n2\n1 1\n1 1" << endl;
        return 0;
    }
    bool ok = false;
    int ansk = 0;
    for (int k=2; k<=n; ++k) {
        if (k*(k-1)/2 == n) {
            ansk = k;
            ok = true;
            break;
        }
    }
    if (!ok) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    cout << ansk << endl;
    vector<int> sum(ansk, 0);
    sum[0] = 1;
    for (int i=1; i<ansk; ++i) sum[i] = sum[i-1] + i;

    rep(i, ansk-1) {
        cout << ansk-1 << ' ';
        rep(j, i) {
            if (j) cout << ' ';
            cout << sum[i] + j;
        }
        for (int j=i; j<ansk-1; ++j) {
            if (j) cout << ' ';
            cout << sum[j]+i;
        }
        cout << endl;
    }

    cout << ansk-1 << ' ';
    rep(i, ansk-1) {
        if (i) cout << ' ';
        cout << sum[i]+i;
    }
    cout << endl;

}


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

int h,w,n,A[700000],x,y;

int main(){

  cin>>h>>w>>n;

  r(i,n){
    cin>>y>>x;
    if(x>w)x++;
    A[i] = (h-y+1) + abs(x-(w+1));
  }

  sort(A,A+n);

  r(i,n-1){
    A[i+1] = max(A[i+1],A[i]+1);
  }
  cout<<A[n-1]<<endl;
}


Measured memory_bytes: 4980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
int n;
ll s(ll x) { return (1 + x) * x / 2;}
int main()
{
	cin >> n;
	cout << s(n) - 3 * s(n / 3) - 5 * s(n / 5) + 15 * s(n / 15);
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	ini(n);
	int a[10000010];
	FOR(i,0,n){in(a[i]);}
	auto x_ = max_element(a,a+n);
	int pos = x_ - a;
	int tmp = a[pos];
	a[pos] = 0;
	auto x = max_element(a, a + n);
	a[pos] = tmp;
	FOR(i, 0, n) {
		if (a[i] == *x_) {
			out(*x);
		}
		else {
			out(*x_);
		}
	}
	return 0;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

const int MAX_T=50;
const int MAX_P=10;
const int PENALTY=1200;
struct team{
public:
  team(){REP(i,MAX_P)wrong[i]=solved[i]=0;}
  int wrong[MAX_P];
  int solved[MAX_P];
};
pair<int,int> score(team& tm,int n){
  pair<int,int> result=make_pair(0,0);
  REP(i,n)
    if(tm.solved[i]!=0){
      result.first++;
      result.second-=tm.wrong[i]*PENALTY+tm.solved[i];
    }
  return result;
}


int t,p;

int main(){ _;
  int r,tid,pid,time;
  string msg;
  while(cin>>t>>p>>r,(t|p|r)!=0){
    team teams[MAX_T];
    REP(i,r){
      cin>>tid>>pid>>time>>msg;
      tid--;pid--;
      if(teams[tid].solved[pid]==0){
	if(msg=="WRONG"){
	  teams[tid].wrong[pid]++;
	}else{
	  teams[tid].solved[pid]=time;
	}
      }
    }
    pair<pair<int,int>,int> result[MAX_T];
    REP(i,t){
      result[i]=make_pair(score(teams[i],p),-i);
    }
    sort(result,result+t,greater<pair<pair<int,int>,int> >());
    REP(i,t){
      cout<<-result[i].second+1<<" "<<result[i].first.first<<" "<<-result[i].first.second<<endl;
    }
  }
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    bool key=true;
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            key=false;
        }
    }
    if(key) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 1024
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt");
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s = input.ReadLine();
        var t = input.ReadLine();

        int count = 0;
        for(int i=0; i<3; i++) {
            if (s[i] == t[i]) count++;
        }

        return count;
    }
}

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

int main(){
    int x;
    cin >> x;
    double max_pow = 0;
    for (double i = 1; i <= x; i++){
        for (double j = 2; j < 10; j++){
            if (pow(i, j) <= x){
                max_pow = max(max_pow, pow(i,j));
            }
        }
    }
    cout << max_pow << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((int)(x).size())

using namespace std;
typedef long long ll;

void solve(long long A, long long B){
  if ((A + B) % 2 == 0) {
    printf("%lld\n", (A + B) / 2);
  } else {
    printf("IMPOSSIBLE\n");
  }
}

int main(){
    long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   int a,b,c;
           cin>>a>>b>>c;
           Yes(a==b&&b==c);
}

Measured memory_bytes: 3492
def fib(n):

    if n ==0 or n ==1:
        return 1
    dp = [0] * (n+1)
    dp[0] = 1
    dp[1] = 1
    for i in range(2,n+1):
        dp[i] += dp[i-1] + dp[i- 2]
    return dp[n ]
# if __name__ == '__main__':
n=int(input())
print(fib(n))



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    ll N, M, K; cin >> N >> M >> K;
    vector<ll> A(N), sumA(N+1);
    for(int i = 0; i < N; ++i){
        cin >> A[i];
        sumA[i+1] = sumA[i] + A[i];
    }
    vector<ll> B(M), sumB(M+1);
    for(int i = 0; i < M; ++i){
        cin >> B[i];
        sumB[i+1] = sumB[i] + B[i];
    }
    ll ans = 0;
    for(int i = 0; i <= N; ++i){
        ll num = i;
        ll now = sumA[i];
        if(now > K) break;
        int idx = upper_bound(sumB.begin(), sumB.end(), K-now) - sumB.begin();
        ans = max(ans, num + idx - 1);
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 9604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M ;
  double goukei=0;
  cin >> N;
  cin >> M;
  vector<int> vec(100);
  
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    goukei += vec.at(i);
  }
  //cout << goukei << endl;
   sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end()); 
  M *= 4;
  goukei /= M;
  M /= 4;
  if (vec.at(M-1)<goukei){
  cout << "No" << endl;
  }else{cout << "Yes" << endl;}
}

Measured memory_bytes: 256
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

int dp[3005][3005][2];
int a[3005];

int dfs(int l, int r, int k) {
    if (dp[l][r][k] != INF) return dp[l][r][k];

    if (l == r) {
        return k == 0 ? a[l] : -a[l];
    }

    int res;
    if (k == 0) {
        res = max(a[l] + dfs(l + 1, r, 1), a[r] + dfs(l, r - 1, 1));
    } else {
        res = min(dfs(l + 1, r, 0) - a[l], dfs(l, r - 1, 0) - a[r]);
    }

    return dp[l][r][k] = res;
}

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

    int N;
    cin >> N;

    REP(i, N) cin >> a[i];

    REP(l, N) REP(r, N) REP(k, 2) dp[l][r][k] = INF;

    cout << dfs(0, N - 1, 0) << endl;

    return 0;
}


Measured memory_bytes: 141312
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000.0



int main(){
	int N,M;
	cin>>N>>M;
	
	vector<vector<int>> A(N,vector<int>(M));
	
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			cin>>A[i][j];
			A[i][j]--;
		}
	}
	
	int ng = 0;
	int ok = N;
	
	while(ok-ng>1){
		int mid = (ok+ng)/2;
		vector<bool> use(M,true);
		bool f = true;
		while(true){
			f=true;
			for(int i=0;i<M;i++){
				if(use[i]){
					goto L;
				}
			}
			f=false;
			break;
			L:
			vector<int> cnt(M,0);
			for(int i=0;i<N;i++){
				for(int j=0;j<M;j++){
					if(use[A[i][j]]){
						cnt[A[i][j]]++;
						if(cnt[A[i][j]]>mid){
							use[A[i][j]]=false;
							f=false;
						}
						break;
					}
				}
				if(!f)break;
			}
			if(f)break;
		}
		if(f)ok=mid;
		else ng=mid;
	}
	
	cout<<ok<<endl;
	
    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }
inline long long tonum(string s) {long long v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string tostr(T x) {ostringstream sout;sout<<x;return sout.str();}



const int MEMO1 = 1010;
const int MEMO2 = 3;

int n;

int main() {
    while (cin >> n) {
        long long num;
        
        vll inp(MEMO1 + 1, 100000000);
        for (int i = 0; i < n; ++i) {
            cin >> num;
            
            inp[MEMO1] = num;
            for (int j = MEMO1-1; j >= 0; --j) {
                if (inp[j] > inp[j+1]) swap(inp[j], inp[j+1]);
            }
        }
        while (inp.back() == 100000000) inp.pop_back();
        
        //COUT(inp);
        
        vector<ll> vec(MEMO2 + 1, 1LL<<61);
        for (int i = 0; i < inp.size(); ++i) for (int j = 0; j < inp.size(); ++j) {
            if (i == j) continue;
            string tmp = tostr(inp[i]) + tostr(inp[j]);
            ll l = tonum(tmp);
            
            vec[MEMO2] = l;
            for (int j = MEMO2-1; j >= 0; --j) {
                if (vec[j] > vec[j+1]) swap(vec[j], vec[j+1]);
            }
        }

        cout << vec[2] << endl;
    }
    return 0;
}


Measured memory_bytes: 1240
#include <iostream>
#include <algorithm>
using namespace std;
const int MAXN = 3e5 + 10;
int nums[MAXN], idx, n, a, b;
bool check (int n, int a, int b) {
    if (a+b > n+1) return false;
    int tmp = n / a;
    if (n % a != 0) tmp++;
    if (b < tmp) return false;
    tmp = n / b;
    if (n % b != 0) tmp++;
    if (a < tmp) return false;
    return true;
}
void solve () {
    if (n == b) {
        for (int i = 0; i < n; i++) {
            nums[idx++] = n-i;
        }
        n = 0;
        return;
    }
    if (n-a >= b-1) {
        for (int i = 0; i < a; i++) {
            nums[idx++] = n-a+1+i;
        }
        n -= a;
        b--;
        return;
    }
    int dist = n-(b-1);
    for (int i = 0; i < dist; i++) {
        nums[idx++] = n-dist+1+i;
    }
    n -= dist;
    b--;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n >> a >> b;
    if (!check(n, min(a, b), max(a, b))) {
        cout << -1 << endl;
        return 0;
    }
    while (n) {
        solve();
    }
    for (int i = 0; i < idx; i++) {
        cout << nums[i];
        if (i+1 == idx) cout << '\n';
        else cout << ' ';
    }


    return 0;
}

Measured memory_bytes: 3328