akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()
typedef long long ll;



int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    
    int sum = 0;
    sum += min(a,k);
    k = max(k-a,0);
    
    k = max(k-b,0);
    
    sum -= min(c,k);
    
    dunk(sum);
    
    return 0;
}



Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while(true){
			String[] tmpArray = br.readLine().split(" ");

			int w = Integer.parseInt(tmpArray[0]);
			int h = Integer.parseInt(tmpArray[1]);

			if(w == 0 && h == 0){
				break;
			}

			int[][] matrix = new int[h][w];

			int x = 0;
			int y = 0;
			for(int i = 0; i < h; i++){
				tmpArray = br.readLine().split(" ");

				for(int j = 0; j < w; j++){
					matrix[i][j] = Integer.parseInt(tmpArray[j]);

					if(matrix[i][j] == 2){
						x = j;
						y = i;
					}
				}
			}
//			System.out.println("Start from "+x+" "+y);
			int result = dfs(matrix, w, h, x, y, 0, 0, 0);
			if(result >= 0 && result <= 10){
				System.out.println(result);
			}
			else {
				System.out.println(-1);
			}
		}
	}

	static int dfs(int[][] matrix, int w, int h, int x, int y, int vx, int vy, int step){
		int result = Integer.MAX_VALUE;
		int breakPosX = -1;
		int breakPosY = -1;
		
		if(step > 10){
			return Integer.MAX_VALUE;
		}

//		System.out.println("STEP " +step+" now "+x+" "+y);
//
//		if(vx == 1){
//			System.out.println("RIGHT");
//		}
//		if(vx == -1){
//			System.out.println("LEFT");
//		}
//		if(vy == 1){
//			System.out.println("DOWN");
//		}
//		if(vy == -1){
//			System.out.println("UP");
//		}

		//???????????¨???????????§?????????
		if(!(vx == 0 && vy == 0)){
			int i = 0;
			while(true){
				//?????????
				if(y + vy*i >= h || x + vx*i >= w || y + vy*i < 0 || x + vx*i < 0){
					//System.out.println("RANGE ERROR " +(y + vy*i )+" "+ (x + vx*i)+" "+( y + vy*i) +" "+ (x + vx*i));
					return Integer.MAX_VALUE;
				}
				//??´????????°???
				if(matrix[y+vy*i][x+vx*i] == 3){
//					System.out.println("GOAL!!");
					return step;
				}

				//??????????????????
				if(matrix[y+vy*(i)][x+vx*(i)] == 1){
					//?????????????????????????????´???
					if(i == 0){
//						System.out.println("COLLISION");
						return Integer.MAX_VALUE;
					}
					matrix[y+vy*(i)][x+vx*(i)] = 0;
					breakPosX = x + vx*(i);
					breakPosY = y + vy*(i);
//					System.out.println("Break "+breakPosX+" "+breakPosY);
					x = x + vx*(i - 1);
					y = y + vy*(i - 1);
					break;
				}

				i++;
			}
		}


//		System.out.println("Now X, Y " + x+ " "+y);

		int tmp;
		//???

		if((tmp = dfs(matrix, w, h, x, y - 1, 0, -1, step+1)) < result){
			result = tmp;
		}

		//???
		if((tmp = dfs(matrix, w, h, x + 1, y, 1, 0, step+1)) < result){
			result = tmp;
		}

		//???
		if((tmp = dfs(matrix, w, h, x - 1, y, -1, 0, step+1)) < result){
			result = tmp;
		}

		//???
		if((tmp = dfs(matrix, w, h, x, y + 1, 0, 1, step+1)) < result){
			result = tmp;
		}

		if(breakPosY >= 0 && breakPosX >= 0){
			matrix[breakPosY][breakPosX] = 1;
		}

//		if(result > 10){
//			return -1;
//		}

		if(vx == 0 && vy == 0){
			return result;
		}
		return result;
	}

}

Measured memory_bytes: 28220
#include <iostream>

using namespace std;

int main(){
    int n, m, days;
    cin >> n >> m;
    days = 0;
    for (int i = 0; i < m; i++){
        int c;
        cin >> c;
        days += c;
    }
    if (n-days >= 0){
        cout << n-days << "\n";
    }
    else {
        cout << -1 << "\n";
    }
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

ll H,W,N;
const int dx [] = {0,1,1,1,0,-1,-1,-1};
const int dy [] = {1,1,0,-1,-1,-1,0,1};

bool in_range(int y,int x)
{
	return y >= 1 && y <= H && x >= 1 && x <= W;
}

int main()
{
	scanf("%lld%lld%lld",&H,&W,&N);
	map< pair<ll,ll>,bool > mp;
	FOR(i,0,N){
		ll a,b;
		scanf("%lld%lld",&a,&b);
		mp [make_pair(a,b)] = true;
		FOR(j,0,8){
			int na = a + dy [j],nb = b + dx [j];
			if(in_range(na,nb) && mp.count(make_pair(na,nb)) == 0){
				mp [make_pair(na,nb)] = false;
			}
		}
	}

	vector<ll> ans(10);
	for(auto it : mp){
		ll y = it.first.first,x = it.first.second;
		if((y >= 2 && y <= H - 1 && x >= 2 && x <= W - 1) == false) continue;
		ll cnt = it.second;
		FOR(i,0,8){
			ll ny = y + dy [i],nx = x + dx [i];
			if(mp.count(make_pair(ny,nx))){
				cnt += mp [make_pair(ny,nx)];
			}
		}
		ans [cnt]++;
	}

	ans [0] = (H - 2) * (W - 2) - accumulate(ans.begin() + 1,ans.end(),0ll);
	FOR(i,0,10){
		printf("%lld\n",ans [i]);
	}

	return 0;
}


Measured memory_bytes: 56448
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];
    vector<ll> dp(n);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (ll i = 2; 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-1] << endl;
}

Measured memory_bytes: 1792
#include <cstdio>

int main(){
       int a,b,d,r;
       double f;

       scanf("%d %d",&a,&b);

       d = a/b;
       r = a%b;
       f = (double)a / (double)b;

       printf("%d %d %f\n",d,r,f);

       return 0;
}

Measured memory_bytes: 2744
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
    int n; cin >> n;
    int xa = 0, bx = 0, bxa = 0;
    vector<string> s(n);
    int cnt = 0;
    rep(i,n) cin >> s.at(i);
    rep(i,n){
        if(s.at(i).at(0) == 'B' && s.at(i).at((int)(s.at(i).size() - 1)) == 'A'){
            bxa++;
        }else if(s.at(i).at(0) == 'B') bx++;
        else if(s.at(i).at((int)(s.at(i).size() - 1)) == 'A') xa++;
        for(int j=1;j<(int)(s.at(i).size());j++){
            if(s.at(i).at(j) == 'B' && s.at(i).at(j-1) == 'A') cnt++;
        }
    }
    cout << cnt + min(xa,bx) + bxa - (xa == 0 && bx == 0) + (xa == 0 && bx == 0 && bxa ==0) << endl;
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		try(Scanner sc=new Scanner(System.in)){
			int n=sc.nextInt();
			
			for(int num=0; num<n; num++) {
				int day=0;
				int y=sc.nextInt();
				int m=sc.nextInt();
				int d=sc.nextInt();
				for(int i=y; i<1000; i++) {
					for(int j=m; j<=10; j++) {
						for(int k=d; k<=((i%3==0)? 20:(j%2==0)? 19:20); k++) {
							day++;
						}
						d=1;
					}
					m=1;
				}
				System.out.println(day);
				
			}
			
		}
	}
} 


Measured memory_bytes: 27432
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
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; }
using namespace std;
typedef long long ll;
const int mx = 100000;

int N, K;
int ans = 0;
vector<int> G[mx];

int dfs(int v, int d){
    int res = (d > K ? 1 : -mx);
    for(int u : G[v])chmax(res, dfs(u, d + 1) + 1);
    if(res == K){ ans++; return -mx; }
    else return res;
}

int main(){

    cin >> N >> K;
    rep(i, N){
        int a;
        cin >> a;
        a--;
        if(i == 0){
            if(a != 0)ans++;
            continue;
        }
        G[a].push_back(i);
    }

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

}

Measured memory_bytes: 10368
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <set>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , b ;
	cin >> a;
	int c = 0; 
	b = a ;
	while( b ) {
		c = c + b % 10;
		b /= 10 ;
	}
	if( a % c == 0 )
		cout << "Yes";
	else if( a % c != 0 )cout << "No";
}


Measured memory_bytes: 3600
/*

Author: @karngyan
Team: BlundersPride

*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef std::vector<ll> vll;

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define cres(c,n) (c).clear(),(c).resize(n)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define ff first
#define ss second
#define mk make_pair
string s , t;
ll ns , nt ;
ll dp[3010][3010];

ll go(ll i , ll j)
{
	if(i >= ns or j >= nt)
		return 0;
	ll &ans = dp[i][j];
	if(ans != -1)
		return ans;
	if(s[i] == t[j])
		ans = 1 + go(i+1 , j+1);
	else
		ans = max(go(i , j+1) , go(i+1 , j));

	return ans;
}



signed main()
{
	fast;
	memset(dp , -1 , sizeof dp);
////////////////////////////////////////////////////////////////////////////////////////////
	
	cin >> s >> t;
	ns = s.length();
	nt = t.length();
	ll ans = go(0,0);
	// cout<<go(0,0)<<endl;

	ll i = 0, j = 0;
	while(i<ns and j<nt)
	{
		if(s[i] == t[j])
		{
			cout<<s[i];
			i++, j++;
		}
		else
		{
			if(dp[i+1][j] > dp[i][j+1])
				i++;
			else
				j++;
		}
	}




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


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

int main()
{
    int A, B;
    cin >> A >> B;

    int sum = A + B;
    if (sum == 3) {
        cout << '3' << endl;
    }
    else if (sum == 4) {
        cout << '2' << endl;
    }
    else {
        cout << '1' << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  char S[7];
  scanf("%s",&S);
  if (S[0] == 'S')
  {
    printf("Cloudy\n");
  }
  else if (S[0] == 'C')
  {
    printf("Rainy\n");
  }
  else
  {
    printf("Sunny\n");
  }
return 0;
}


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

typedef long long ll;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
vector<int> G[maxn];

ll mul(ll a, ll b) {
    return (a * b) % mod;
}

pair<ll,ll> dfs(int a, int par) {
    
    ll all_white = 1;
    ll some_black = 0;

    for (int b: G[a]) {
        if (b == par) continue;
        pair<ll,ll> p = dfs(b, a);
        // p.first - no of ways to color the subtree rooted at b such that b is colored black
        // p.second - no of ways to color the subtree rooted at b such that b is colored white
        ll tmp_white = all_white;
        // a will be colored black iff all its children are colored white
        all_white = mul(all_white, p.second);
        // a will be colored white if 0 or more of its children are colored black
        some_black = (mul(tmp_white, p.first) + mul(some_black, p.first + p.second)) % mod;
    }

    return { all_white, (all_white + some_black) % mod };
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n; cin >> n;

    for (int i = 0; i < n-1; ++i) {
        int a, b;
        cin >> a >> b; 
        G[a].push_back(b);
        G[b].push_back(a);
    }

    pair<ll,ll> p = dfs(1, -1);

    cout << ((p.first + p.second) % mod )<< "\n";
}

Measured memory_bytes: 12672
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a==b && b==c) {
			System.out.println("No");
			return;
		}
		if(a!=b && b!=c && c!=a) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
	}

}


Measured memory_bytes: 22612
import sys
sys.setrecursionlimit(10**9)
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)


def chouhoukei(count, ans, num):
    if count == 4:
        return ans
    else:
        if num >= N - 1:
            return 0
        if A[num] == A[num + 1]:
            return chouhoukei(count + 2, ans * A[num], num + 2)
        else:
            return chouhoukei(count, ans, num + 1)


print(chouhoukei(0, 1, 0))


Measured memory_bytes: 79928
#include <math.h>
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  int N; cin>>N;
  string S; cin>>S;
  S = " " + S;

  auto dp = vector<vvb>(N+1, vvb(4, vb(1000, false)));
  // dp[i][j][k] := [1,i] で j 文字選び、パスを k にできるか

  dp[0][0][0] = true; // [0,0] で 0 文字を選んでパスを 0 にすることは可能とする
                      // dp[1][1][S[1]-'0'] = true; が更新されるためには上記が必要

  for(int i=1; i<=N; i++) {
    for(int j=0; j<=3; j++) {
      for(int k=0; k<=999; k++) {
        if (dp[i-1][j][k]) {
          // S[i] を取らない
          dp[i][j][k] = dp[i-1][j][k];

          // S[i] を取る
          if (j<3 && k*10 + (S[i]-'0') < 1000) {
            dp[i][j+1][k*10 + (S[i]-'0')] = dp[i-1][j][k];
          }
        }
      }
    }
  }


  int ans = 0;
  REP(k, 1000) {
    if (dp[N][3][k]) ans++;
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 23040
import sys
def input(): return sys.stdin.readline().rstrip()
class Facts:
  def __init__(self, mod=10**9+7, n_max=1):
    self.mod     = mod
    self.n_max   = n_max
    self.fact    = [1, 1]
    self.inv     = [0, 1]
    self.factinv = [1, 1]
    if 1 < n_max:
      setup_table(n_max) 
  
  def cmb(self, n, r):
    if r < 0 or n < r:
      return 0
    if self.n_max < n:
      self.setup_table(n)
    return self.fact[n] * (self.factinv[r] * self.factinv[n-r] % self.mod) % self.mod
  
  def setup_table(self, t):
    for i in range(self.n_max+1,t+1):
      self.fact.append( self.fact[-1] * i % self.mod )
      self.inv.append( -self.inv[self.mod % i] * (self.mod // i) % self.mod )
      self.factinv.append( self.factinv[-1] * self.inv[-1] % self.mod )
    self.n_max = t

def main():
    n,m,k=map(int,input().split())
    mod=998244353
    f=Facts(mod)
    ans=0
    t=m*pow(m-1,n-1-k,mod)
    for kx in range(k,-1,-1):
        ans+=f.cmb(n-1,kx)*t%mod
        t=t*(m-1)%mod
    print(ans%mod)


if __name__=='__main__':
    main()

Measured memory_bytes: 109612
import collections
N = int(input())
x = []
for i in range(N):
	x.append(list(map(int, input().split())))
if N == 1:
	print(1)
else:
	L = []
	for i in range(N):
		a, b = x[i][0], x[i][1]
		for j in range(N):
			if a > x[j][0] or b > x[j][1]:
				L.append((a - x[j][0], b - x[j][1]))
	c = collections.Counter(L)
	max = c.most_common(1)[0][1]
	print(N - max)

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

int main()
{
    int n,k;
    cin>>n>>k;
    vector <int> val(n);
    for(int i=0;i<n;i++)
    	cin>>val[i];
    bool dp[k+1]={0};
    for(auto x:val)
    	dp[x]=1;

    for(int i=1;i<=k;i++)
    	for(auto x:val)
    		if(i - x >= 0 and dp[i-x]==0)
    		{
    				dp[i]=1;
    				break;
    		}

    if(dp[k])
    	cout<<"First\n";
    if(!dp[k])
    	cout<<"Second\n";
}

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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define rep(i,n) for(int i=0;i<(n);i++)
int N,M;
using Graph=vector<vector<int> >;

int DFS(int v,vector<bool> visited,Graph &G){

    bool all=true;

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

    if(all)return 1;
    int ret=0;

    for(auto x:G[v]){
        if(visited[x])continue;
        visited[x]=true;
        ret+=DFS(x,visited,G);
        visited[x]=false;
    }
    return ret;
}

int main(){
    cin>>N>>M;
    Graph G(N);
    rep(i,M){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<bool> visited(N,false);
    visited[0]=true;

    cout<<DFS(0,visited,G)<<endl;

    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0
for i in range(N):
    if A[i] > B[i]:
        ans += B[i]
        A[i] -= B[i]
        B[i] = 0
    else:
        ans += A[i]
        B[i] -= A[i]
        A[i] = 0
    if B[i] > 0:
        if A[i+1] > B[i]:
            ans += B[i]
            A[i+1] -= B[i]
            B[i] = 0
        else:
            ans += A[i+1]
            B[i] -= A[i+1]
            A[i+1] = 0

print(ans)

Measured memory_bytes: 18752
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,k;
    cin>>n>>k;
    int sum=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        sum+=min(a,k-a);
    }
    cout<<sum*2<<endl;
}


Measured memory_bytes: 256
n, m, l = map(int, input().split())

A = []
B = []

for i in range(n):
    A.append([int(j) for j in input().split()])
    
for i in range(m):
    B.append([int(j) for j in input().split()])
    
B_T = list(map(list, zip(*B)))

C = [[0 for j in range(l)] for i in range(n)]

for i in range(n):
    for j in range(l):
        C[i][j] = sum([a * b for (a, b) in zip(A[i], B_T[j])])
        
for i in range(n):
    print(*C[i])


Measured memory_bytes: 7076
// ABC049C.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

string stringList[4] = {"maerd","remaerd","esare","resare"};

int main()
{
	string str;
	cin>>str;
	string reverseStr;
	int n = str.length();
	for(int i = n-1; i >= 0; i--){
		reverseStr.push_back(str[i]);
	}
	bool canMake = true;
	while(reverseStr.length() != 0){
		if( reverseStr.length() < 5){
			canMake = false;
			break;
		}
		
		rep(i,4){
			if( reverseStr == stringList[i]){
				canMake = true;
				break;
			}
		}
		bool match = false;
		if(reverseStr.length() >= 5){
			rep(i,4){
				if(reverseStr.substr(0,5) == stringList[i]){
					reverseStr = reverseStr.substr(5,reverseStr.length()-5);
					match = true;
				}
			}
		}
		if(reverseStr.length() >= 6){
			rep(i,4){
				if(reverseStr.substr(0,6) == stringList[i]){
					reverseStr = reverseStr.substr(6,reverseStr.length()-6);
					match = true;
				}
			}
		}
		if(reverseStr.length() >= 7){
			rep(i,4){
				if(reverseStr.substr(0,7) == stringList[i]){
					reverseStr = reverseStr.substr(7,reverseStr.length()-7);
					match = true;
				}
			}
		}
		if(match == false){
			canMake = false;
			break;
		}
		
	}
	if( canMake == true){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}

	return 0;
}



Measured memory_bytes: 640
import sys

def solve():
    input = sys.stdin.readline
    A, B, K = map(int, input().split())
    count = 1
    for i in reversed(range(1, 101)):
        if A % i == 0 and B % i == 0:
            if count == K: 
                print(i)
                break
            else: count += 1
    


    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
#include <iostream>
using namespace std;long long i=0,n,q,x,r,l,m,a[100000],t[100001],s[100001];main(){cin>>n>>q;for(;i<n;i++){cin>>a[i];s[i+1]=s[i]+a[i];t[i+1]=(i?t[i-1]:0)+a[i];}while(q--){cin>>x;l=0;r=n+1;while(r-l>1){m=(r+l)/2;(abs(a[n-m]-x)>abs(a[n-(m+1)/2]-x)?r:l)=m;}cout<<s[n]-s[n-(l+1)/2]+t[max(n-l-(l&1),0LL)]<<endl;}}


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

int main(){
  int ans=0;
  uint64_t X;
  uint64_t ori=100;
  cin >> X;
  while(X>ori){
    ori = (uint64_t)(ori*1.01);
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <bitset>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

typedef long long ll;
typedef pair<ll, ll> P;

//static const ll MOD = 1000000007;
//static const ll INF = 100000000;

int main() {
    // input
    ll N;
    cin >> N;
    ll a[N];
    for (ll i = 0; i < N; i++) {
        cin >> a[i];
    }

    // process
    ll ans = 0, current_num = 1;
    bool success_flag = false;

    for (ll i = 0; i < N; i++) {
        if (a[i] == current_num) {
            current_num++;
            success_flag = true;
        } else {
            ans++;
        }
    }

    if (success_flag) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <climits>
using namespace std;

bool comp(pair<int, string> a, pair<int, string> b){
    if(a.first != b.first) return a.first > b.first;
    else return a.second < b.second;
}

long int jou(long int x, long int y){
    long int f = 1;
    for(int i = 0; i < y; ++i){
        f = f * x % int(powl(10,9) + 7);
    }

    return f;
}

bool pn(long int x){
    if(x != 2 && x % 2 == 0)
        return false;

    for(int i = 3; i < x; ++i){
        if(x != i && x % i == 0)
            return false;
    }
    return true;
}

int main(){
    long int x;
    cin >> x;

    if(x % 11 > 6)
        cout << x / 11 * 2 + 2 << endl;
    else if(x % 11 > 0)
        cout << x / 11 * 2 + 1 << endl;
    else
        cout << x / 11 * 2 << endl;

    
    return 0;
}

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



int gcd( int a, int b ){

         if( b == 0 ) return a;

         return gcd( b, a % b );

         }


int main(){


    int n, i;

    int ans = 0;


    cin >> n;


    vector<int> a(n + 1);


    for( i = 1 ; i <= n ; i = i + 1 ){

         cin >> a.at(i);

         }

    
    for( i = 1 ; i <= n ; i = i + 1 ){

         ans = gcd( a.at(i), ans );

         }
 

    cout << ans << endl;

    return 0;

    }


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <tuple>
 
using namespace std;
 
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define cina(s, n, a) for(int i = s; i < n; i++) cin >> a[i]
#define couta(n, a) for(int i = 0; i < n; i++) cout << a[i] << ' '
#define copy(s, n, a, b) for(int i = s; i < n; i++) b[i] = a[i]
#define yesno(ok) cout << (ok ? "YES" : "NO")
#define mod(a, b) (b + (a % b)) % b
#define MOD (ll)1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;


void solve(){
    ll n, w;
    cin >> n >> w;
    vector <vll> dp(3, vll(w + 1, 0));
    vll a(n + 1), b(n + 1);
    for(ll i = 1; i <= n; i++) cin >> a[i] >> b[i];
    
    for(ll i = 1; i <= n; i++){
        for(int j = 1; j <= w; j++){
            dp[2][j] = dp[1][j];
            if(a[i] <= j) dp[2][j] = max(dp[2][j], b[i] + dp[1][j - a[i]]);
        }
        for(int j = 1; j <= w; j++){
            dp[1][j] = dp[2][j];
        }
    }
    cout << dp[2][w];
}
 
int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for(int i = 1; i <= q; i++){
        solve();
    }
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,x,y,z,i,j;
    cin>>a>>b;
    x=a+b;
    y=a-b;
    z=a*b;

    i=max(x,y);
    j=max(y,z);
    cout<<max(i,j)<<endl;

    return 0;
}


Measured memory_bytes: 3596
from sys import stdin

n,k,q = [int(x) for x in stdin.readline().rstrip().split()]
li = []
for _ in range(q):
    li.append(stdin.readline().rstrip())
li = list(map(int, li))
p = k-q
lin = [p for _ in range(n)]
for i in range(q):
    lin[li[i]-1] += 1
for v in range(n):
    if lin[v] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 13380
macro_rules! scan {
    ( $( $x:ident ),*; $t:ty ) => {
        let mut buf = String::new();
        let mut itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

fn main() {
    scan!(a; i32);
    scan!(b; i32);
    println!("{}", 6-(a+b));
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

struct UnionFind {
    //number of parents(par[i] = i => root)
    vector <int> par;
    //rank of tree
    vector <int> rank;

    UnionFind(int n) : par(n), rank(n, 1) {
        //initialize
        rep(n, i) par[i] = i;
    }

    //find root (keiroasshuku at the same time)
    int root(int x){
        if (par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    //unite
    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (rank[x] > rank[y]) swap(x, y);
        par[x] = y;
        if (rank[x] == rank[y]) rank[y]++;
    }

    //same tree?
    bool same(int x, int y){
        return root(x) == root(y);
    }
};

void solve(void){

	int N, M;
	cin >> N >> M;

	vector <int> as(M), bs(M);

	rep(M, i)
	{
		cin >> as[i] >> bs[i];
		as[i]--, bs[i]--;
	}

	int ans = 0;

	rep(M, i)
	{
		UnionFind uf(N);

		rep(M, j)
		{
			if (i != j)
			{
				uf.unite(as[j], bs[j]);
			}
		}

		if (!uf.same(as[i], bs[i]))
		{
			ans++;
		}

		//putln(ans);

	}

	putln(ans);

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
#include <list>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> vi;

const int INF = (int)1e10;

int main(void) {
				int n, k, q;
				cin >> n >> k >> q;
				vi a(n);
				REP(i, n){
								cin >> a[i];
				}
				int ans = INF;
				REP(i, n){
								//cout << "i :" << i << endl;
								ll x = a[i];
								vector<vi> d;
								d.push_back(vi(0));
								REP(j, n){
												int idx = d.size() - 1;
												if(a[j] >= x){
																d[idx].push_back(a[j]);
												}	else {
																if(d[idx].size() != 0) {
																		d.push_back(vi(0));
																		idx++;
																}
												}
								}
								vi e;
								REP(j, d.size()){
												sort(ALL(d[j]));
												for(int l = 0; l < (int)d[j].size() - k + 1; l++){
													e.push_back(d[j][l]);
												}
												//REP(l, d[j].size()) cout << d[j][l] << " ";
												//cout << endl;	
								}
								sort(ALL(e));
								//REP(l, e.size()) cout << e[l] << " ";
								//cout << endl;
								if(e.size() >= q){
												int res = e[q - 1] - e[0];
												ans = min(ans, res);
								}
				}
				cout << ans << endl;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    llint a=0, b=0, c=0, d=0, e=0;
    string s;
    for(int in=0;in<n;in++) {
        cin >> s;
        if(s.at(0)=='M') a++;
        else if(s.at(0)=='A') b++;
        else if(s.at(0)=='R') c++;
        else if(s.at(0)=='C') d++;
        else if(s.at(0)=='H') e++;
        else ;
    }

    llint ans;
    ans = a*b*c + a*b*d + a*b*e + a*c*d + a*c*e + a*d*e + b*c*d + b*c*e + b*d*e + c*d*e;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wsign-compare"

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, A) for (auto & a : A)
#define all(a) (a).begin (), (a).end ()
#define f first
#define s second

typedef long long ll;

const ll MOD = 1e+9+7;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const ll MAXN = 1e+6+7;

int main ()
{
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	int i, j, n;
	string s;
	cin >> s;
	for (i = 0; i < s.size (); ++i) cout << 'x';
	cout << '\n';

	return 0;
}



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

#define int long long
signed main(){
    int n;
    cin >>n;
    if(n==25)cout << "Christmas";
   if(n==24)cout << "Christmas Eve";
    if(n==23)cout << "Christmas Eve Eve";
    if(n==22)cout << "Christmas Eve Eve Eve";
    return 0;

  
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		StringBuffer s = new StringBuffer(sc.next());
		int q = sc.nextInt();

		int r = 1;

		for (int i = 0; i < q; i++) {
			int t = sc.nextInt();
			if (t == 1) {
				r *= -1;
			} else {
				int f = sc.nextInt();
				String c = sc.next();

				if ((r == 1 && f == 1) || r == -1 && f == 2) {
					s.insert(0, c);
				} else {
					s.append(c);
				}
			}
		}
		if ( r == -1) {
			s.reverse();
		}
		System.out.println(s);
	}

}


Measured memory_bytes: 62976
/*Author : Hrishi*/

/*When I wrote this, only God and I understood what I was doing.
Now, only God knows.*/

#include <bits/stdc++.h>

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define PB push_back
#define F(i,L,R) for(auto i=L; i<R ;i++)
#define FR(i,L,R) for(auto i=R-1;i>=L;i--)
#define show(x) cout<<(#x)<<" is "<<(x)<<"\n";
#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define M 1000000007

using namespace std;

vi val(101);
vl w(101);
vector<vl> dp(101,vl(1e5 + 1,1e15));

int main() 
{
//	int test;
//	cin>>test;
//	while(test--)
	{
	    int n,wt;
	    cin>>n>>wt;
	    ll totval=0;
	    F(i,0,n)
	    {
	        cin>>w[i]>>val[i];
	        totval+=val[i];
	    }
	    
        F(i,0,n)
            dp[i][0] = 0;
            
        dp[0][val[0]] = w[0];
        
        F(i,1,n)
        {
            F(j,1,totval+1)
            {
                if(j-val[i] >= 0)
                    dp[i][j] = min(dp[i-1][j-val[i]]+w[i] , dp[i-1][j]);
                else dp[i][j] = dp[i-1][j];
            }
        }
 
        for(ll j=totval;j>=0;j--)
        {
            if(dp[n-1][j]<=wt)
            {
                cout<<j<<"\n";
                break;
            }
        }
	    
	}

}




Measured memory_bytes: 80256
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::max_element;
using std::vector;

int main() {
  int N, C;
  vector<int> s(100000), t(100000), c(100000);
  vector<int> sm(200002);
  vector<int> tt(200002);
  cin >> N >> C;
  for (int i = 0; i < N; ++i)
    cin >> s[i] >> t[i] >> c[i];
  for (int i = 1; i <= C; ++i) {
    for (int j = 0; j < 200002; ++j) {
      tt[j] = 0;
    }
    for (int j = 0; j < N; ++j) {
      if (c[j] == i) {
        ++tt[s[j] * 2 - 1];
        --tt[t[j] * 2];
      }
    }
    for (int j = 1; j < 200002; ++j) {
      tt[j] += tt[j - 1];
    }
    for (int j = 0; j < 200002; ++j) {
      if (tt[j] > 0) {
        ++sm[j];
      }
    }
  }
  //~ int mx = 0;
  //~ for (int j = 0; j < 200002; ++j) {
    //~ if (mx < sm[j]) {
      //~ mx = sm[j];
    //~ }
  //~ }
  cout << *max_element(sm.begin(), sm.end()) << endl;
}


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

int main() {
    int N, K, R, S, P;
    cin >> N >> K >> R >> S >> P;
    string T, keep;
    cin >> T;
    for (int i = 0; i < N; i++) {
        char c = T.at(i);
        if (c == 'r') {
            keep += 'p';
        }
        else if (c == 's') {
            keep += 'r';
        }
        else {
            keep += 's';
        }
    }
    for (int i = 0; i + K < N; i++) {
        vector<bool> rsp(3, false);
        if (keep.at(i) == keep.at(i + K)) {
            if (keep.at(i) == 'r') {
                rsp.at(0) = true;
            }
            else if (keep.at(i) == 's') {
                rsp.at(1) = true;
            }
            else {
                rsp.at(2) = true;
            }
            if (i + K + K < N) {
                if (keep.at(i + K + K) == 'r') {
                    rsp.at(0) = true;
                }
                else if (keep.at(i + K + K) == 's') {
                    rsp.at(1) = true;
                }
                else {
                    rsp.at(2) = true;
                }
            }
            for (int j = 0; j < 3; j++) {
                if (!rsp.at(j)) {
                    if (j == 0) {
                        keep.at(i + K) = 'r';
                    }
                    else if (j == 1) {
                        keep.at(i + K) = 's';
                    }
                    else {
                        keep.at(i + K) = 'p';
                    }
                    break;
                }
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (T.at(i) == 'r' && keep.at(i) == 'p') {
            ans += P;
        }
        else if (T.at(i) == 's' && keep.at(i) == 'r') {
            ans += R;
        }
        else if (T.at(i) == 'p' && keep.at(i) == 's') {
            ans += S;
        }
    }
    cout << ans << endl;
}

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

void repri(int r, char direction){
    for (int i = 0; i < r; i++)
    {
        printf("%c", direction);
    }
    return;
}

int main(){
    int sx,sy,tx,ty;
    scanf("%d%d%d%d", &sx, &sy, &tx, &ty);
    //cout << sx << ',' << sy << endl;
    //cout << tx << ',' << ty << endl;
    int xdis = tx - sx, ydis = ty - sy;
    //cout << xdis << ',' << ydis;
    
    repri(xdis, 'R');
    repri(ydis, 'U');
    repri(xdis, 'L');
    repri(ydis, 'D');
    repri(1, 'D');
    repri(xdis + 1, 'R');
    repri(ydis + 1, 'U');
    repri(1, 'L');
    repri(1, 'U');
    repri(xdis + 1, 'L');
    repri(ydis + 1, 'D');
    repri(1, 'R');

    return 0;
}

Measured memory_bytes: 256
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

h,w,k=mp()
rh=[i for i in range(h)]
rw=[i for i in range(w)]
grid=[]
for i in range(h):
    grid.append(input())
lh=[]
lw=[]
for i in range(h):
    lh.extend(list(itertools.combinations(rh, i)))
for i in range(w):
    lw.extend(list(itertools.combinations(rw, i)))



ans=0

for x in lh:
    for y in lw:



        ch=[[0]*w for i in range(h)]
        for i in range(h):
            for j in range(w):
                if i in x or j in y:
                    ch[i][j]=1
        c=0
        for i in range(h):
            for j in range(w):
                if ch[i][j]==0 and grid[i][j]=="#":
                    c+=1


        if c==k:
            ans+=1
print(ans)


Measured memory_bytes: 74640
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
const i64 MOD = 1e9 + 7;
int main() {
    i64 N, K;
    cin >> N >> K;
    vector<int> A(N);
    i64 ans = 0;
    for(auto &x : A) cin >> x;
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            i64 tmp = 0;
            if(A[i] > A[j]) {
                tmp = K * (K + 1) / 2;
            } else if(A[i] < A[j]) {
                tmp = (K - 1) * K / 2;
            }
            tmp %= MOD;
            ans += tmp;
            ans %= MOD;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    int a[4];
    for(int i = 0; i < 4; i++) cin >> a[i];
    int sum = 0;
    for(int i = 0; i < 4; i++) {
        sum += a[i];
    }
    int ans = 1e9;
    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < i; j++) {
            int now = a[i] + a[j];
            chmin(ans, abs(now - (sum - now)));
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        if(a % 2 == 1) continue;
        if(a % 3 != 0 && a % 5 != 0 ){
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << 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++)
#define ll long long int

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

int a[n],b[n];
pair<int,ll>A[n];
rep(i,n){
  cin>>a[i]>>b[i];
  A[i]=make_pair(a[i],b[i]);
}
sort(A,A+n);
pair<int,ll>DP[n];
DP[0]=make_pair(A[0].first,A[0].second);
for(int i=1;i<n;i++){
  DP[i]=make_pair(A[i].first,DP[i-1].second+A[i].second);
  }
rep(i,n){
if(DP[i].second>=k){
  cout<<DP[i].first<<endl;
  return 0;
}

}
  return 0;
}


Measured memory_bytes: 4096
import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner scan =new Scanner(System.in);
int a=scan.nextInt();
int b=scan.nextInt();
int c=scan.nextInt();
int sum=0;
for(int i=a;i<=b;i++){
if(c%i==0)
sum=sum+1;
}
System.out.println(sum);
}
}

Measured memory_bytes: 26376
<?php
fscanf(STDIN, "%d %d %d %d", $a1, $a2, $b1, $b2);
$dup_s=0;
$dup_e=0;
if($a1 <= $b1 && $b1 <= $a2){
    if($a2 <= $b2){// a1 b1 a2 b2
        $dup_s = $b1; 
        $dup_e = $a2 ;
    }else{//  a1 b1 b2 a2 
        $dup_s = $b1;
        $dup_e = $b2 ;
    }
}elseif($b1 <= $a1 && $a1 <= $b2){
    if($b2 <= $a2){// b1 a1 b2 a2
        $dup_s = $a1;
        $dup_e = $b2;
    }else{// b1 a1 a2 b2
        $dup_s = $a1;
        $dup_e = $a2 ;
    }
}
echo ($dup_e - $dup_s); 

Measured memory_bytes: 4604
import math
a,b,x = map(int,input().split())

#case
if x < a**2*b/2: #底ケース
	w = 2*x/(a*b)
	ans =math.degrees(math.atan(b/w))


else: #側面ケース
	now_h = (2*x)/(a**2) - b
	ans = math.atan((b-now_h)/a)
	ans = 180*ans/math.pi


print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
using namespace std;
int main(int argc, char *argv[])
{
  const int BIG = 1000000;
  const int CMAX = 25000;
  for(;;) {
    int n;
    cin >> n;
    if(n == 0) break;
    vector<int> ps;
    for(int i = 0; i < n; i++) {
      int p; cin >> p; ps.push_back(p);
    }
    // shop : at most 100
    // change : at most 49900... too much? to get 50, max = 25000
    // # of 500 got so far : at most 100
    // value : minimum payment
    
    vector<vector<int>> dp(CMAX+1, vector<int>(101, BIG));
    vector<vector<int>> dpnew(CMAX+1, vector<int>(101, BIG));
    dpnew[0][0] = 0;
    int cmax = 0;
    for(int i = 0; i < n; i++) {
      const int ii = i + 1;
      // not buying
      for(int j = 0; j <= cmax; j++) {
        for(int k = 0; k <= i; k++) {
          dp[j][k] = dpnew[j][k];
        }
      }
      // buying
      for(int j = 0; j <= cmax; j++) {
        const int p = ps[i] % 1000;
        if(p != 0 && p <= 500) { // got 500!
          const int jj = min(j + 500 - p, CMAX);
          cmax = min(max(cmax, jj), CMAX);
          for(int k = 0; k <= i; k++) {
            const int kk = k + 1;
            if(dpnew[jj][kk] > dp[j][k] + ps[i]) {
              dpnew[jj][kk] = dp[j][k] + ps[i];
            }
          }
        } else {
          // get 500 if possible!
          const int q = (p == 0 ? 1000 : p) - 500;
          if(j >= q) {
            const int jj = j - q;
            for(int k = 0; k <= i; k++) {
              const int kk = k + 1;
              if(dpnew[jj][kk] > dp[j][k] + ps[i]) {
                dpnew[jj][kk] = dp[j][k] + ps[i];
              }
            }
          } else { // get change
            const int jj = j + 1000 - p;
            cmax = min(max(cmax, jj), CMAX);
            if( jj < 1000) {
              for(int k = 0; k <= i; k++) {
                const int kk = k;
                if(dpnew[jj][kk] > dp[j][k] + ps[i]) {
                  dpnew[jj][kk] = dp[j][k] + ps[i];
                }
              }
            }
          }
        }
      }
    }
    for(int k = 100; k >= 0; k--) {
      int p = BIG;
      for(int j = 0; j <= cmax; j++) {
        p = min(p, dpnew[j][k]);
      }
      if(p != BIG) {
        cout << k << " " << p << endl;
        break;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 24332
#include<stdio.h>
int main()
{
    int n,i,j,a,f=0,b,c,s=0;
    scanf("%d",&n);
    a=n;
    b=n;
    for(c=n;c>0; )
    {
        c=n/10;
        n=n/10;
        f++;
    }
    for(i=0;i<f;i++)
    {
        s=s+(a%10);
        a=a/10;
    }
    if(b%s==0)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 128
main = do
  [n,_] <- map read . words <$> getLine :: IO [Int]
  ds <- map read . words <$> getLine :: IO [Int]
  let ls = filter (`notElem` ds) [0..9]
  let len = length $ show n
  let made1 = filter (>=n) $ make ls len 
  let made2 = filter (>=n) $ make ls (len+1)
  print $ if not $ null made1 then minimum made1 else minimum made2
   
make :: [Int] -> Int -> [Int]
make xs 1 = xs
make xs 2 = [a+b | a<-xs, b<-map (*10) xs]
make xs 3 = [a+b+c | a<-xs, b<-map (*10) xs, c<-map (*100) xs]
make xs 4 = [a+b+c+d | a<-xs, b<-map (*10) xs, c<-map (*100) xs, d<-map(*1000) xs]
make xs 5 = [a+b+c+d+e | a<-xs, b<-map (*10) xs, c<-map (*100) xs, d<-map(*1000) xs, e<-map(*10000) xs]

Measured memory_bytes: 892
#include<cstdio>

int main(void){
	char t[1024], h[1024];
	int n, i, j, tp=0, hp=0;
	scanf("%d", &n);
	for(i=0; i<n; ++i){
		for(j=0; j<1024; ++j){t[j]=h[j]=0;}
		scanf("%s%s", t, h);
		for(j=0; j<1024; ++j){
			if(t[j]>h[j]){ tp+=3; goto out;}
			else if(t[j]<h[j]){ hp+=3; goto out;}
			else if((t[j]==h[j])&&(!t[j])){ ++tp; ++hp; goto out;}
		}
		out:;
	}
	printf("%d %d\n", tp, hp);
	return(0);
}


Measured memory_bytes: 2756
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N, *S = read().split() 
    
    d = Counter(S)
    for result in ['AC','WA','TLE','RE']:
        if result in d:
            print(f"{result} x {d[result]}")
        else:
            print(f"{result} x 0")


if __name__ == "__main__":
    main()


Measured memory_bytes: 17232
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")



int main() {
    int h,w; cin >> h >> w;
    vector<vector<pair<char,ll>>> dp(h,vector<pair<char,ll>>(w));

    rep(i,h){
        rep(j,w) {
            cin >> dp[i][j].first;
            dp[i][j].second = 0;
        }
    }

    dp[0][0].second = (dp[0][0].first == '#')?1:0;

    for(int i = 0; i < h; i ++){
        for(int j = 0; j < w; j ++){
            if(i == 0 && j == 0) continue;


            if(i == 0) dp[i][j].second = dp[i][j-1].second + ((dp[i][j].first == '#' && dp[i][j - 1].first == '.') ? 1 : 0);
            else if(j == 0) dp[i][j].second = dp[i-1][j].second + ((dp[i][j].first == '#' && dp[i-1][j].first == '.') ? 1 : 0);
            else {
                dp[i][j].second = min(
                        dp[i - 1][j].second + ((dp[i][j].first == '#' && dp[i - 1][j].first == '.') ? 1 : 0),
                        dp[i][j - 1].second + ((dp[i][j].first == '#' && dp[i][j - 1].first == '.') ? 1 : 0));
            }
        }
    }

    cout <<  dp[h-1][w-1].second << endl;

    return 0;
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
 using namespace std;
 int main(){
 	int n,k;
 	cin>>n>>k;
      int ma[325000];
 	for(int i=0;i<n;i++){
 		int x;
 		cin>>x;
      	ma[x]++;
 	}
 	sort(ma,ma+n+1);
 	int ans=0;
 	for(int i=0;i<=n-k;i++){
 	 ans+=ma[i];
 }
 cout<<ans;	
 	return 0;
 }

Measured memory_bytes: 1024