akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;
	
	
class Hoge{
			
			string s0;
			int iN,ichange1,ichange2;
			int *pnum,*ptile1,*ptile2;
			
		public:
			Hoge(int hoge){
						cin>>s0;
						iN=s0.length();
						pnum=new int[iN];
						ptile1=new int[iN];
						ptile2=new int[iN];
						
						
						//cout<<"iN="<<iN<<endl;
						
						//pnum[3]=42;
						
						//cout<<pnum[3]<<endl;
			}
		void input();
		string output(int);	
		void convert();
		int output0(int);
		int check(int*);
		int getichange();
		void gettile();
									
		virtual ~Hoge(){	
					delete [] pnum;
					delete [] ptile1;
					delete [] ptile2;
					//cout<<"pyama is erased."<<endl;
						}
};



void Hoge::input(){
		
					cin>>s0;
					//cout<<s0.substr(3,1)<<endl;
					}
					
					
string Hoge::output(int itemp){
							string souttemp=s0.substr(itemp,1);
							cout<<souttemp<<endl;
							return souttemp;
							}
							
							
int Hoge::output0(int itemp){
						
							cout<<pnum[itemp]<<endl;
							return pnum[itemp];
							
							}

void Hoge::convert(){

			string stemp;
			int itemp=0;
			
			
			for(int icount=0;icount<iN;icount++){
				
					stemp=s0.substr(icount,1);	
					pnum[icount]=atoi(stemp.c_str());
					
					ptile1[icount]=itemp;
					itemp=(itemp-2)*(-1)-1;
					ptile2[icount]=itemp;
					
					//cout<<"stemp="<<stemp<<endl;
					//cout<<"pnum="<<pnum[icount]<<endl;
					
						
						
			}//endfor


}//endfunction



int Hoge::check(int* itiletemp){

			//string stemp;
			int ichange=0;
			
			for(int icount=0;icount<iN;icount++){
				
			if(pnum[icount]!=itiletemp[icount]){
									ichange++;
								}//end if
					
						
						
			}//endfor
			
			return ichange;
		}//endfunction
		
int Hoge::getichange(){
						int ichange0;
						ichange1=check(ptile1);
						ichange2=check(ptile2);
						
						ichange0=ichange1;
						if(ichange1>ichange2){
												ichange0=ichange2;
												}
						
						//cout<<"ichange0="<<ichange0<<endl;
						return ichange0;
						}//endfunction


void Hoge::gettile(){

				for(int icount=0;icount<iN;icount++){
				
		
					cout<<ptile1[icount];
						
						
			}//endfor
			
				cout<<endl;
				}//endfunction

int main()
{
	
	Hoge* ph0=new Hoge(0);
	ph0->convert();
	//ph0->input();
	//ph0->output(3);
	//ph0->output0(3);
	
	cout<<ph0->getichange()<<endl;
	
	
	delete ph0;
	
}

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

int main()
{
  int n, m, q;
  cin >> n >> m >> q;
  int a[q], b[q], c[q], d[q], path[n], ans(0);
  for (int i = 0; i < q; ++i) cin >> a[i] >> b[i] >> c[i] >> d[i];
  
  function<void(int, int)> search = [&](int cur, int lb) {
    if (cur == n) {
      int cost(0);
      for (int i = 0; i < q; ++i)
        if (path[b[i] - 1] - path[a[i] - 1] == c[i])
          cost += d[i];
      ans = max(ans, cost);
    } else {
      for (int i = lb; i <= m; ++i) {
        path[cur] = i;
        search(cur + 1, i);
      }
    }
  };
  search(0, 1);
  cout << ans << '\n';
}


Measured memory_bytes: 3600
import math

while True:
    a, op, b = input().split()
    
    if op == '+':
        x = int(a) + int(b)
        print(x)   
    elif op == "-":
        y = int(a) - int(b)
        print(y)
    elif op == "*":
        kake = int(a) * int(b)
        print(kake)
    elif op == "/":
        wari = int(a) / int(b)
        print(math.floor(wari))
    elif op == "?":
        break


Measured memory_bytes: 5664
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	static final long MOD = 998244353L;
	
	Main() {
		FastScanner scanner = new FastScanner();
		int N = scanner.nextInt();
		long M = scanner.nextInt();
		int K = scanner.nextInt();
		init(N);
		
		long Ans = 0L;
		for (int i = 0; i <= K; i++) {
			Ans = ( Ans + (M * combination(N-1, i) % MOD) * modPow(M-1, N-1-i) % MOD ) % MOD;
		}
		
		System.out.println(Ans);
	}
	
	public static void main(String[] args) {
		new Main();
	}
	
	long[] fac, finv, inv;
	
	void init(int max) {
		max += 1;
		fac = new long[max];
		finv = new long[max];
		inv = new long[max];
		
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for (int i = 2; i < max; i++) {
			fac[i] = fac[i - 1] * i % MOD;
			inv[i] = MOD - inv[(int) (MOD % i)] * (MOD / i) % MOD;
			finv[i] = finv[i - 1] * inv[i] % MOD;
		}
	}
	
	long combination(int n, int k) {
		if (n < k) return 0;
		if (n < 0 || k < 0) return 0;
		return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}
	
	long modPow(long a, long n) {
		long res = 1;
		while (n > 0) {
			if ( (n & 1) == 1) res = res * a % MOD;
			a = a * a % MOD;
			n >>= 1;
		}
		return res;
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private int readByte() {
		if (hasNextByte()) return buffer[ptr++];
		else return -1;
	}
	
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
		return hasNextByte();
	}
	
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 37984
using System;

namespace AtC155
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ABC = Console.ReadLine().Split(' ');
            int count = 0;
            if (ABC[0] == ABC[1]) count++;
            if (ABC[1] == ABC[2]) count++;
            if (ABC[2] == ABC[0]) count++;

            if (count == 1) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 13140
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)








int main() {
    string s;
    cin >> s;
    ll ans = 0, cnt = 0;
    REP(i, s.size()){
        if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
            cnt++;
        }
        else{
            cnt = 0;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
/*
    ____        __
   / __ \____  / /_  ____ _____ ___
  / /_/ / __ \/ __ \/ __ `/ __ `__ \
 / _, _/ /_/ / / / / /_/ / / / / / /
/_/ |_|\____/_/ /_/\__,_/_/ /_/ /_/
*/
#include<bits/stdc++.h>

typedef long long ll ;

#define pll pair<ll , ll >
#define X   first
#define Y   second
#define mp  make_pair
#define pii pair<int , int>
#define vec vector
#define vpii vector<pair<int , int>>
#define i_n   int i = 0 ; i< n ; i++
#define cn  int n ; cin>>n
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define cina int a[n] ; for(int i = 0 ; i < n ; i++) cin>>a[i]
#define pb push_back

using namespace std;
const int maxn = 1000*100+5 ;
const ll inf = 9223372036854775807 ;

int n , h[maxn] , dp[maxn] ; 
int main()
{
	migmig ;
	cin>>n ; 
	for(int i = 1 ; i <= n ; i ++ )
	{
		cin>>h[i] ;
	}
	dp[1] = 0 ; 
	dp[2] = abs(h[2] - h[1]) ; 
	
	for(int i = 3 ; i <=n  ; i++ )
	{
		dp[i] = min( dp[i-1] + abs( h[i] - h[i-1] ) , dp[i-2] + abs( h[i] - h[i-2] )  ) ; 
	}
	cout<<dp[n] ; 
}
//////
////////
///////////




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

int const MAX = 100005;
int a[MAX];

int main() {
    int n;
    cin >> n;
    rep(i, n) {
        int x;
        cin >> x;
        a[x - 1]++;
        a[x]++;
        a[x + 1]++;
    }

    sort(a, a + MAX, greater<int>());

    cout << a[0] << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    ll no;
    cin>>no;
    vector<string>v;
    string str;
    while(no--)
    {
        cin>>str;
        v.push_back(str);
    }
    ll cnt_AC=0,cnt_WA=0,cnt_TLE=0,cnt_RE=0;
    for(ll i=0;i<v.size();i++)
    {
        // cout<<v[i]<<" ";
        if(v[i][0]=='A')
            cnt_AC++;
        else if(v[i][0]=='T')
            cnt_TLE++;
        else if(v[i][0]=='W')
            cnt_WA++;
        else if(v[i][0]=='R')    
            cnt_RE++;
    }
    cout<<"AC x "<<cnt_AC<<" "<<"\n";
    cout<<"WA x "<<cnt_WA<<" "<<"\n";
    cout<<"TLE x "<<cnt_TLE<<" "<<"\n";
    cout<<"RE x "<<cnt_RE<<" "<<"\n";
    return 0;
}


Measured memory_bytes: 7464
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < n - 1; i++) {
			if(a[i] == a[i + 1] && a[i] <= 100) {
				a[i + 1] += 1000;
				ans++;
				i++;
			}
		}
		System.out.println(ans);
	}

	static int func(long x) {
		int ret = 0;
		while(x > 0) {
			ret += x % 10;
			x /= 10;
		}
		return ret;
	}

}


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

bool ism(int a) {
    return a != 0 && a <= 12;
}

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

    string s;
    cin >> s;
    int a = stoi(s.substr(0, 2));
    int b = stoi(s.substr(2, 2));

    if (ism(a) && ism(b)) {
        cout << "AMBIGUOUS" << endl;
    } else if (ism(a)) {
        cout << "MMYY" << endl;
    } else if (ism(b)) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n;
int a[200100];
int dp[200100];
int main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=2;i<=n;i++){
		cin>>a[i];
	}
	for(int i=n;i>=1;i--){
		dp[a[i]]++;
	}
	for(int i=1;i<=n;i++)
		cout<<dp[i]<<'\n';
	cout<<endl;
	return 0;
}


Measured memory_bytes: 5208
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  map<string,int> memo;
  rep(i,n){
    string buf;cin>>buf;
    memo[buf]+=1;
  }
  int res=0;
  for(auto it=memo.begin();it!=memo.end();++it){
    ++res;
  }
  cout<<res<<"\n";
  return 0;
}


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

int main() {
	int N;
	cin >> N;
	int box[110];

	for (int i = 0; i < N; ++i) {
		cin >> box[i];
	}

	int sum = 0;
	int min_kari = box[0];
	int min;

	for (int i = 0; i < N; ++i) {
		if (min_kari > box[i]) min_kari = box[i];
	}

	min = min_kari;
	int max_kari = 0;
	int max;

	for (int i = 0; i < N; ++i) {
		if (max_kari < box[i]) max_kari = box[i];
	}
	max = max_kari;

	sum = max - min;
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#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;

#define MAX 100005
#define INF 1001001001

void out(vector<int> a) {
  int n = a.size();
  rep(i,n) {
    cout << a[i];
    if (i==n-1) cout << endl;
    else cout << " ";
  }
}
int main(int, char**)
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  if(prev_permutation(a.begin(), a.end())) out(a);
  next_permutation(a.begin(), a.end()); out(a);
  if(next_permutation(a.begin(), a.end())) out(a);

  return 0;
}



Measured memory_bytes: 3160
while True:
    H,W=map(int,input().split())
    if(H==0 and W==0):
        break
    for i in range(H):
        for j in range(W):
            if(i==0 or j==0 or i==H-1 or j==W-1):
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()


Measured memory_bytes: 7000
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

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

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int id,degree;
      int[] child;
      String[] words;
      Tree tree = new Tree(n);

      for(int i=0,k=0; i<n; i++,k=0){
        words = br.readLine().split(" ");
        id = Integer.parseInt(words[k++]);
        tree.node[id].id     = id;
        tree.node[id].degree = degree = Integer.parseInt(words[k++]);
        tree.node[id].child  = child  = new int[degree];

        for (int j=0,c=0,l=0; j<degree; j++,l=c) {
          c = child[j] = Integer.parseInt(words[k++]);

          if( j==0 ) tree.node[id].leftChild = c;
          else tree.node[l].rightSibling = c;

          tree.node[c].parent = id;
        }
      }

      int root=0;
      for (TreeNodeB e : tree.node)
        if(e.parent == Tree.NIL) root = e.id;
      tree.calcDepth(root, 0);

      System.out.print(tree.dispTreeNode());
    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }
}

class Tree {

  static final int NIL = -1;
  TreeNodeB[] node;

  public Tree(int size) {
    node = new TreeNodeB[size];
    for (int i=0; i < size; i++) {
      node[i] = new TreeNodeB();
    }
  }

  void calcDepth(int u, int p) {
    do {
      node[u].setDepth(p);

      if( node[u].leftChild != Tree.NIL )
        calcDepth(node[u].leftChild, p+1);
      
      u = node[u].rightSibling;
    } while( u != Tree.NIL);
  }

  public String dispTreeNode() {
    StringBuilder s = new StringBuilder();

    for (TreeNodeB n : node)
      s.append(n).append("\n");

    return s.toString();
  }
}

class TreeNodeB {
  int id,degree,parent;
  private int depth,type;
  int leftChild,rightSibling;
  int[] child;

  public TreeNodeB() {
    this.id =
    this.degree =
    this.parent =
    this.leftChild =
    this.rightSibling = Tree.NIL;
  }

  public String getType() {
    switch(type) {
      case 0:
        return "root";
      case 1:
        return "internal node";
      default:
        return "leaf";
    }
  }
  public void setDepth(int d) {
    depth = d;
    if(depth > 0) {
      if(degree > 0)
        setType(1);
      else
        setType(2);
    }
  }
  public void setType(int t) {
    this.type = t;
  }

  @Override
  public String toString() {
    return "node " + id + ": parent = " + parent + ", depth = " + depth + ", "
      + getType() +", " + Arrays.toString(child);
  }
}


Measured memory_bytes: 133540
s_a = list(input())[::-1]
s_b = list(input())[::-1]
s_c = list(input())[::-1]
 
person = "a"
 
try:
  while True:
    if person == "a":
      person = s_a.pop()
    elif person == "b":
      person = s_b.pop()
    else:
      person = s_c.pop()
except IndexError:
  print(person.upper())

Measured memory_bytes: 3060
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long long solve(int n, vector<int>& A, vector<vector<int>>& B) {
        int N = 1 << n;
        int m = A.size();
        vector<int> M(m, 0);
        for (int i = 0; i < m; ++i) {
            for (auto x : B[i]) {
                M[i] |= 1 << x;
            }
        }

        const long long INF = 1LL << 50;
        vector<long long> dp(N, INF);
        dp[0] = 0;

        for (int i = 0; i < m; ++i) {
            for (int j = N - 1; j >= 0; --j) {
                auto& ans = dp[j | M[i]];
                ans = min(ans, dp[j] + A[i]);
            }
        }

        auto res = dp[N - 1];
        if (res >= INF) {
            return -1;
        }
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;

    vector<int> A(m);
    vector<vector<int>> B(m);
    for (int i = 0; i < m; ++i) {
        int n = 0;
        cin >> A[i] >> n;
        for (int j = 0; j < n; ++j) {
            int x;
            cin >> x;
            --x;
            B[i].push_back(x);
        }
    }

    Solution sol;
    cout << sol.solve(n, A, B) << "\n";

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

Int N, T;
vector<P> A;

Int used[3010][6010];
Int mem[3010][6010];

Int dfs(Int idx, Int t){

  if(t >= T || idx >= N) return 0;
  if(used[idx][t]++) return mem[idx][t];

  Int a = dfs(idx + 1, t);
  Int b = dfs(idx + 1, t + A[idx].first) + A[idx].second;
  Int res = max(a, b);
  return mem[idx][t] = res;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin>>N>>T;
  A.resize(N);
  cin>>A;
  sort(A.begin(), A.end());

  Int ans = dfs(0, 0);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 281344
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

int main(int argc, char** argv) {
  int N;
  cin >> N;
  vector<string> s(N);
  rep(i, N) {
    cin >> s[i];
  }

  map< vector<int> , int64_t> cnts_map;

  rep(i, N) {
    vector<int> cnts(27, 0);

    for (int j = 0; j < 10; ++j) {
      cnts[(s[i][j] - 'a')] += 1;
    }

    // For Debug
    // rep(j, 27) {
    //   cout << cnts[j];
    // }
    // cout << endl;

    auto it = cnts_map.find(cnts);
    if (it != cnts_map.end()) {
      it->second++;
    } else {
      cnts_map[cnts] = 1;
    }
  }

  // For Debug
  // cout << cnts_map.size();

  int64_t r = 0;
  for (auto it : cnts_map) {
    int64_t cnt = it.second;
    if (cnt > 1) {
      r += cnt * (cnt -1) / 2;
    }
  }
  cout << r << endl;

  // For debug
  // cout << N << endl;
  // rep(i, N) {
  //   cout << s[i];
  // }
}


Measured memory_bytes: 27648
a, b = [int(_) for _ in input().split()]

def gcd(p, q):
    if q < p:
        p, q = q, p
    if q % p == 0:
        return p
    else:
        return (gcd(p, q-(q//p)*p))

print(int(a * b / gcd(a, b)))



Measured memory_bytes: 2940
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
#define INF 1000000000000000000
ll n,m;
ll G[300][300];
ll G2[300][300];
int main(){
        cin >> n >> m;
        REP(i,n) {
                REP(j,n) {
                        if(i == j)
                                continue;
                        G[i][j] = INF;
                }
        }
        REP(i,m) {
                ll a,b,c;
                cin >> a >> b >> c;
                a--;b--;
                G[a][b] = G[b][a] = c;
        }
        REP(i,n) {
                REP(j,n) {
                        G2[i][j] = G[i][j];
                }
        }

        REP(k,n) {
                REP(i,n) {
                        REP(j,n) {
                                G[i][j] = min(G[i][j],G[i][k] + G[k][j]);
                        }
                }
        }

        ll c = 0;
        REP(i,n) {
                FOR(j,i + 1,n) {
                        if(G2[i][j] < INF && G[i][j] < G2[i][j]) {
                                c++;
                        }
                }
        }
        cout << c << endl;
        return 0;
}


Measured memory_bytes: 768
/**
 * ??????????????????

????????¨??±?????????????????????????????????????????????????????????n???????????????????????£????????????n????????????????????????????????????????????§?????????????????????????????????????????????????????????????????¢????????????????????????????????????????????????????????????????????????????????§??§?????????????????????????????????????????¨????????????????????????????????????????????????????????´?????????????????????????????????????????????????????????

????????¨??±???????????????????????????????????±???????????????????????????????????????????????????????????????????????????????????°????????????????????????

Constraints
??\?????§?????????????????????1000????¶????????????¨????????????
????????????????????????????????????100??\?????§???????????¢??????????????????????°?????????????????????????
Input
??????????????????????????°?????????????????????????¶????n??????????????????????????????????????±??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????±???????????????????????????????????????????????§?????????

Output
??????????????°??????????????????????????????????????°????????±??????????????¨?????????????????????????????????????????°?????????????????????????????????????????????

Sample Input
3
cat dog
fish fish
lion tiger
Sample Output
1 7
 */

#include <iostream>
#include <sstream>

int main(int argc, char const *argv[]) {
  unsigned short n;
  std::string Param;

  while (true) {

    getline(std::cin, Param);
    std::istringstream iss(Param);
    iss >> n;

    if (n > 1000) {
      std::cout << "Error: 1 <= x <= 1000" << std::endl;
    } else {
      break;
    }
  }

  std::string TaroCard, HanakoCard;
  unsigned short Taro, Hanako;
  Taro = Hanako = 0;

  for (size_t i = 0; i < n; i++) {
    getline(std::cin, Param);
    std::istringstream iss(Param);
    iss >> TaroCard >> HanakoCard;
    iss.clear();
    if (TaroCard > HanakoCard) {
      Taro += 3;
    } else if (TaroCard < HanakoCard) {
      Hanako += 3;
    } else {
      Taro++;
      Hanako++;
    }
  }
  std::cout << Taro << " " << Hanako << std::endl;
  return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>                                           
 
//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 1e6 + 25;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int x, y, f[N], n, k;


int binpow (int a, int n) {
	int res = 1;
	while (n) {
		if (n & 1)
			res = res * 1ll * a % mod;
		a = a * 1ll * a % mod;
		n >>= 1;
	}
	return res;
}

int rev (int x) {
	return binpow(x, mod - 2);
}


void precalc () {
	f[0] = 1;
	forn (i, 1, N - 1)
		f[i] = f[i - 1] * 1ll * i % mod;
}

int cnk (int n, int k) {
	return f[n] * 1ll * rev(f[k] * 1ll * f[n - k] % mod) % mod;
}


main () {
	precalc();
	cin >> x >> y;
	if ((x + y) % 3) {
		cout << 0;
		return 0;	
	}

	n = (x + y) / 3;
	k = x - n;
	if (k < 0 || k > n)
		cout << 0;
	else
		cout << cnk(n, k);	
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

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

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

    int tmp;
    int cnt = 0;
    int t,u;
    while(!S.empty()) {
        tmp = *begin(S);
        t = S.size();
        S.erase(tmp);
        u = S.size();
        if(t - u <= 1){
            cnt++;
        }
        
        for (int i = 2; i*tmp <= 1000000; i++) {
            S.erase(tmp*i);
        }
    }
    printf("%d\n", cnt);

}

Measured memory_bytes: 13480
moji = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

ans = 0
n = int(input())
s1 = ['' for _ in range(n)]
for j in range(n):
    s = input()
    a = ''
    for i in  moji:
        a += i + str(s.count(i))
    s1[j] = a
s1.sort()
cnts = []
before = s1[0]
cnt = 0
for S in s1:
    if before == S:
        cnt += 1
    else:
        cnts.append(cnt)
        before = S
        cnt = 1
cnts.append(cnt)
for i in cnts:
    if i == 1:
        continue
    ans += i * (i - 1) / 2
print(int(ans))

Measured memory_bytes: 15784
while(True):
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        pass

    for i in range(h):
        for j in range(w):
            if(i == 0 or i == h-1 or j == 0 or j == w-1):
                print("#", end = "")
            else:
                print(".", end="")
        print()
    print()


Measured memory_bytes: 7000
package main

import (
  "fmt"
  "math"
)

func main(){
  var str string
  fmt.Scan(&str)
  
  ans := 0
  tmp := 0
  for _, char := range str{
    if char == 'A' || char == 'C' || char == 'T' || char == 'G' {
    	tmp++
    } else {
      ans = int(math.Max(float64(tmp), float64(ans)))
      tmp = 0
    }
  }
  fmt.Println(int(math.Max(float64(tmp), float64(ans))))
}


Measured memory_bytes: 512
a = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
cnt = 0
for k in range(1,a+1):
  if k%2 == 1 and len(make_divisors(k)) == 8:
    cnt += 1
print(cnt)

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

int main(void) {
    int a, b, c;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> c;
    cout << min(a + b, min(b + c, c + a)) << "\n";
    return 0;
}

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

#define MEM(a, b)           memset(a, (b), sizeof(a))
#define CLR(a)              memset(a, 0, sizeof(a))
#define MAX(a, b)           ((a) > (b) ? (a) : (b))
#define MIN(a, b)           ((a) < (b) ? (a) : (b))
#define ABS(X)              ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X)                ( (X) * (X) )
#define SZ(V)               (int )V.size()
#define FORN(i, n)          for(int i = 0; i < n; i++)
#define FORAB(i, a, b)      for(int i = a; i <= b; i++)
#define ALL(V)              V.begin(), V.end()
#define ALLR(V)              V.rbegin(), V.rend()
#define IN(A, B, C)         ((B) <= (A) && (A) <= (C))
//#define AIN(A, B, C)        assert(IN(A, B, C))

#define watch2(x , y)       cout << (#x) << " " << (#y)<< " is " << (x) << " " << (y)<< endl
#define watch(x)            cout << (#x) << " is " << (x) << endl
#define hitAi               ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);ios::sync_with_stdio(0)

#define ll                  long long int
#define xx                  first
#define yy                  second
#define pb(x)               push_back(x)
#define PI                  acos(-1.0)

#define PII                 pair<int, int>
#define PLL                 pair<long long int, long long int>
#define VI                  vector <int>


//cout << fixed << setprecision(20) << p << endl;

template <class T> inline T bigmod(T p,T e,T M){
    ll ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N | (1<<pos);}
//int reset(int N,int pos){return N= N & ~(1<<pos);}
//bool check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/



using namespace std;



int main ()
{
   //freopen("E:/Desktop/Programming/input.txt", "r" , stdin );

    hitAi;
    ll n , x , testCase , m , y   ;

    cin >> n >> m ;
    ll ans = 0;

    if (n>1) ans+= n*(n-1)/2;
    if (m>1) ans+= m*(m-1)/2;

    cout << ans << endl;







}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int M; ll K; cin >> M >> K;
  ll ans[1LL<<(M+1)]; ll cnt = 0;
  if(K>=(1LL<<M) || (M==1 && K==1)){
    cout << -1 << endl; return 0;
  }
  if(M==1 && K==0){
    cout << "0 0 1 1" << endl; return 0;
  }
  rep(i, 1LL<<M){
    if(i==K){
      ans[(1LL<<M)-1] = K;
      ans[(1LL<<(M+1))-1] = K;
    }
    else{
      ans[cnt] = i;
      ans[(1LL<<(M+1))-2-cnt] = i;
      cnt++;
    }
  }
  rep(i, 1<<(M+1)){
    if(i!=0) cout << " "; cout << ans[i];
  }
  cout << endl;
}


Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
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; }
const long long INF = 1LL << 60;


// <<fixed<<setprecision(6)<<


int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}


int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}


int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}


int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main(){
  lint money=100;
  lint x;
  lint count=0;
  cin>>x;
  for(;money<x;count++){
    money+=money/100;
  }
  cout<<count;
}

Measured memory_bytes: 3632
//-----by LY02------------------------------------
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
//------------------------------------------------


int st[100010];
int dp[100010];
//------------------------------------------------
int main() {
//------------------------------------------------
//	freopen("In.txt","r",stdin);
//	freopen("Out.txt","w",stdout);
//------------------------------------------------
	ios::sync_with_stdio(0);
	cin.tie(0);
//------------------------------------------------

int n,k; cin>>n>>k;
for(int i=0;i<n;i++)
	cin>>st[i];
	
dp[0]=0;
for(int i=1;i<n;i++)
{
	dp[i]=INT_MAX;
	for(int j=1;j<=k && i-j>=0;j++)
	{
		dp[i]=min(dp[i] , dp[i-j]+abs(st[i]-st[i-j]));
	}

}
	
cout<<dp[n-1]<<endl;

//------------------------------------------------
	return 0;
}





//-----by LY02------------------------------------


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
using namespace std;

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

    int sum = 0;
    for (int m = 0; m < M; ++m)
    {
        int A;
        cin >> A;
        sum += A;
        if (sum > N)
            break;
    }

    int ans = N - sum;
    if (ans < 0)
        cout << -1 << endl;
    else
        cout << ans << endl;
}

Measured memory_bytes: 3628
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;
using i64 = int_fast64_t;
constexpr i64 MAX = 10000000;
constexpr i64 MOD = 1000000007;
i64 fac[MAX], finv[MAX], inv[MAX];
template <i64 modulus>
class modcal
{

public:
  i64 a;

  constexpr modcal(const i64 x = 0) noexcept : a(x % modulus) {}
  constexpr i64 &value() noexcept { return a; }
  constexpr const i64 &value() const noexcept { return a; }
  constexpr modcal operator+(const modcal rhs) const noexcept
  {
    return modcal(*this) += rhs;
  }
  constexpr modcal operator-(const modcal rhs) const noexcept
  {
    return modcal(*this) -= rhs;
  }
  constexpr modcal operator*(const modcal rhs) const noexcept
  {
    return modcal(*this) *= rhs;
  }
  constexpr modcal operator/(const modcal rhs) noexcept
  {
    return modcal(*this) /= rhs;
  }
  constexpr modcal &operator+=(const modcal rhs) noexcept
  {
    a += rhs.a;
    if (a >= modulus)
    {
      a -= modulus;
    }
    return *this;
  }
  constexpr modcal &operator-=(const modcal rhs) noexcept
  {
    if (a < rhs.a)
    {
      a += modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modcal &operator*=(const modcal rhs) noexcept
  {
    a = a * rhs.a % modulus;
    return *this;
  }
  constexpr modcal &operator/=(modcal rhs) noexcept
  {
    i64 exp = modulus - 2;
    while (exp)
    {
      if (exp % 2)
      {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }

  void COMninit()
  {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
      fac[i] = fac[i - 1] * i % modulus;
      inv[i] = MOD - inv[modulus % i] * (modulus / i) % modulus;
      finv[i] = finv[i - 1] * inv[i] % modulus;
    }
  }
  i64 COMn(i64 n, i64 k)
  {
    if (n < k)
      return 0;
    if (n < 0 || k < 0)
      return 0;
    return fac[n] * (finv[k] * finv[n - k] % modulus) % modulus;
  }
  constexpr modcal<1000000007> modpow(const modcal<1000000007> &a, i64 n)
  {
    if (n == 0)
      return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1)
      t = t * a;
    return t;
  }
};
using modc = modcal<1000000007>;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
modc x,y;
cin >> x.a >> y.a;

i64 m = (2 * x.a - y.a) / 3;
i64 n = (2 * y.a - x.a) / 3;
if((x.a + y.a) % 3 || n < 0 || m < 0){
    cout << 0 << endl;
    return 0;
}
else{
    modc ans = 0;
    ans.COMninit();
    cout << ans.COMn(n + m, n) << endl;
}
}

Measured memory_bytes: 234624
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()


typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

#ifdef TESTING
#define DEBUG fprintf(stderr,"====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define DEBUG 
#define VALUE(x)
#define debug(...)
#endif
/*
inline string IntToString(ll a) {
	char x[100];
	sprintf_s(x, "%lld", a); string s = x;
	return s;
}

inline ll StringToInt(string a) {
	char x[100]; ll res;
	strcpy_s(x, a.c_str()); sscanf_s(x, "%lld", &res);
	return res;
}
*/

inline string uppercase(string s) {
	int n = SIZE(s);
	rep(i, n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
	return s;
}

inline string lowercase(string s) {
	int n = SIZE(s);
	rep(i, n) if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
	return s;
}


int main()
{
	int n;
	cin >> n;
	vs s(n);
	rep(i, n)
		cin >> s[i];
	sort(all(s));
	/*rep(i, n)
		cout << s[i] << " " << endl;*/
	int ans = 1;
	REP(i, 1, n)
	{
		if (s[i - 1] != s[i])
			ans++;
	}
	if (ans == 3)
		puts("Three");
	else
		puts("Four");
	return 0;
}


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

void file() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void fast()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
}

int h, w;
char grid[101][101];
int dp[101][101];

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

    cin>>h>>w;
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            cin>>grid[i][j];
            dp[i][j] = INT_MAX;
        }
    }

    dp[0][0] = grid[0][0] == '#';

    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if (i)
                dp[i][j] = min(dp[i][j], dp[i - 1][j] + (grid[i][j]!=grid[i - 1][j] and grid[i][j]=='#'));
            if (j)
                dp[i][j] = min(dp[i][j], dp[i][j - 1] + (grid[i][j]!=grid[i][j - 1] and grid[i][j]=='#'));
        }
    }
   cout<<dp[h - 1][w - 1];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i >= 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main(){
	int x,a,b; cin >> x >> a >> b;
	x-=a;
	cout << x%b << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        int[] a = Read.ints();
        int ans = a.Sum() / 2;
        if (a.Sum() % 2 == 1) { ans++; }
        Console.WriteLine(ans);
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int K;
    int array[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cin >> K;
  
   cout << array[K-1];
  
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main(){ 
    int n; cin >> n;
    if(n)cout << 0 << ln;
    else cout << 1 << ln;
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  int n=s.size();
  int sumg=0,sump=0;
  for(int i=0;i<n;i++){
    if(s[i]=='g')sumg++;
    else sump++;
  }
  cout<<sumg-(n+1)/2<<endl;
}

Measured memory_bytes: 512
#include <stdio.h>

const int MAX_V = 1000000;

int main() {
	int i, k, v;
	int prime[MAX_V + 1];
	int sum[MAX_V + 2];
	for (i = 2; i <= MAX_V; i++) {
		prime[i] = 1;
	}
	for (i = 2; i * i <= MAX_V; i++) {
		if (prime[i]) {
			for (k = 2 * i; k <= MAX_V; k += i) {
				prime[k] = 0;
			}
		}
	}
	sum[1] = 0;
	sum[2] = 0;
	for (i = 2; i <= MAX_V; i++) {
		sum[i + 1] = sum[i] + prime[i];
	}
	while (scanf("%d", &v) != EOF) {
		printf("%d\n", sum[v + 1]);
	}
	return 0;
}

Measured memory_bytes: 8836
#include<iostream>

using namespace std;
#define MAX 100001


int depth[MAX];
struct Node {
	int parent;
	int lchild;
	int rsibling;
};
Node tree[MAX];

void print(int node)
{
	cout << "node " << node << ": parent = " << tree[node].parent << ", depth = " << depth[node] << ", ";
	if (tree[node].parent == -1)
		cout << "root, [";
	else if (tree[node].lchild == -1)
		cout << "leaf, [";
	else
		cout << "internal node, [";

	if (tree[node].lchild != -1)
	{
		cout << tree[node].lchild;
		int k = tree[node].lchild;
		while (tree[k].rsibling!= -1)
		{
			cout << ", " <<tree[k].rsibling;
			k = tree[k].rsibling;
		}
	}
	cout << "]" << endl;
}
void getDepth(int node,int dep)
{
	  depth[node] = dep;
	if(tree[node].lchild!=-1)
	  getDepth(tree[node].lchild,dep+1);
	if (tree[node].rsibling != -1)
	  getDepth(tree[node].rsibling,dep);

}
int main()
{
	int n,root;
	int index, num;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		tree[i].lchild = -1;
		tree[i].parent = -1;
		tree[i].rsibling = -1;
	}
	for (int i = 0; i < n; i++)
	{
		cin >> index >> num;
		int t = 0;
		int l,k;
		while (t<num)
		{
			cin >> k;
			if(t == 0)
			{
				tree[index].lchild = k;
			}
			else
			{
				tree[l].rsibling = k;
			}
			tree[k].parent = index;
			l = k;
			t++;
		}
	}
	for(int i = 0; i < n; i++)                 //确定根节点
	{
		if (tree[i].parent == -1)
		{
			root = i;
			break;
		}
	}
	getDepth(root,0);
	for (int i = 0; i < n; i++)                 //打印
	{
		print(i);
	}
	return 0;
}


Measured memory_bytes: 4648
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rep1n(i, n) for(int i=1;i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
int main() {

	ll n, m;
	cin >> n >> m;
	if (m <= 2 * n) {
		cout << m / 2;
	}
	else {
		m -= 2 * n;
		cout << n + m / 4;


	}

	return 0;
}





Measured memory_bytes: 256