akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define S scanf
#define P printf
#define G getline
#define C clear()
#define B begin()
#define E end()
#define V vector
#define Fi first
#define Se second
#define PI acos(-1)
#define PS push
#define PP pop
#define PSB push_back
#define PPB pop_back
#define MP make_pair
#define LL long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MLI map<long long int,int>

void FAST();
LL big_mod(LL val,LL pow,LL mod);


int dx[]= {-1,1,0,0};
int dy[]= {0,0,-1,1};

int row,col,ans;
int mark[1005][1005];
string grid[1002];
queue<pair<PII,int> >q;

void run_bfs()
{
    int i,x,y,cost,x1,y1,cost1;
    pair<PII,int>temp;
    while(!q.empty())
    {
        temp=q.front();
        q.pop();
        x=temp.Fi.Fi;
        y=temp.Fi.Se;
        cost=temp.Se;
        for(i=0; i<4; i++)
        {
            x1=x+dx[i];
            y1=y+dy[i];
            cost1=cost+1;
            if(x1>=0 && x1<row && y1>=0 && y1<col && grid[x1][y1]=='.')
            {
                mark[x1][y1]=cost1;
                grid[x1][y1]='#';
                q.push(MP(MP(x1,y1),cost1));
                ans=max(ans,cost1);
            }
        }
    }
}

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,j;
    cin >> row >> col;
    for(i=0; i<row; i++)
    {
        cin >> grid[i];
        for(j=0; j<col; j++)
        {
            if(grid[i][j] == '#')
            {
                q.push(MP(MP(i,j),0));
            }
        }
    }

    run_bfs();
    cout << ans;

//    for(i=0; i<row; i++)
//    {
//        for(j=0; j<col; j++)
//        {
//            cout << mark[i][j] << ' ';
//        }
//        cout << endl;
//    }
    return 0;
}






void FAST()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

LL big_mod(LL val,LL pow,LL mod)
{
    LL res=1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}


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

int main(){
  int n = 0;
  cin >> n;
  int x1, x2;
  int x3 = 0;
  rep(i, n){
    cin >> x1 >> x2;
    x3 += x2 - x1;
  }
  cout << x3 + n << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
char a[105][105];
int r[105],c[105];
int main() {
	//freopen("in.txt","r",stdin);
	int h,w;
	cin>>h>>w;
	int i,j;
	for(i=1; i<=h; i++) {
		for(j=1; j<=w; j++) {
			cin>>a[i][j];
		}
	}
	int t;
	for(i=1; i<=h; i++) {
		t=0;
		for(j=1; j<=w; j++) {
			if(a[i][j]=='.')
				t++;
		}
		if(t==w) r[i]=1;
	}

	for(i=1; i<=w; i++) {
		t=0;
		for(j=1; j<=h; j++) {
			if(a[j][i]=='.')
				t++;
		}
		if(t==h) c[i]=1;
	}
    int f;
	for(i=1; i<=h; i++) {
		f=0;
		for(j=1; j<=w; j++) {
              if(c[j]||r[i]) continue;
			  cout<<a[i][j]; 
			  f=1;
		}
		if(f)
		  cout<<endl; 
	}
	return 0;
}

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

using namespace std;

long int mod = 1e9+7;

int main() {
	int n,m;
	cin>>n>>m;
	string s[n];
	
	for(int i=0; i<n; i++) {
	    cin>>s[i];
	}
	long int dp[n][m] = {0};
	for(int i=0; i<n; i++) {
	    for(int j=0; j<m; j++) {
	       if(s[i][j] == '.') {
	           if(i==0 && j==0) {
	               dp[i][j] = 1;
	           } else if(i==0) {
	               dp[i][j] = dp[i][j-1];
	           } else if(j==0) {
	               dp[i][j] = dp[i-1][j];
	           } else {
	               dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
	           }
	       } else dp[i][j] = 0;
	    }
	}
	
	cout<<dp[n-1][m-1];
	return 0;
}

Measured memory_bytes: 9088
#include <iostream>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    stack<int> S1;
    stack<pair<int,int> > S2;
    char ch;
    int sum=0;
    for (int i=0; cin >> ch; i++) {
        if (ch=='\\') {
            S1.push(i);
        } 
        else if (ch=='/' && S1.size()>0) {
            int j = S1.top(); 
            S1.pop();
            sum+=i-j;
            int a = i-j;
            while (S2.size()>0&&S2.top().first>j) {
                a += S2.top().second; 
                S2.pop();
            }
            S2.push(make_pair(j,a));
        }
    }
    vector<int> ans;
    while (S2.size()>0) {
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(),ans.end());
    cout << sum << endl;
    cout << ans.size() << flush;
    for (int i=0; i<ans.size(); i++) {
        cout << " " << flush;
        cout << ans[i] << flush;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3164
#include <iostream>
using namespace std;
typedef long long ll;

const ll MOD = 998244353;

ll modpow(ll x, ll n){
    ll res = 1;
    ll mul = x;
    while(n){
        if(n % 2) res = res * mul % MOD;
        mul = mul * mul % MOD;
        n /= 2;
    }
    return res;
}

ll dp[2][100000];
ll dp2[2][100000];

int main()
{
    int n;
    cin >> n;
    int a[303];
    ll s = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        s += a[i];
    }
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= 90000; j++) dp[i % 2][j] = dp[(i + 1) % 2][j] * 2 % MOD;
        for(int j = 0; j <= 90000; j++) dp[i % 2][j + a[i - 1]] = (dp[i % 2][j + a[i - 1]] + dp[(i + 1) % 2][j]) % MOD;
    }
    dp2[0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= 90000; j++) dp2[i % 2][j] = dp2[(i + 1) % 2][j];
        for(int j = 0; j <= 90000; j++) dp2[i % 2][j + a[i - 1]] = (dp2[i % 2][j + a[i - 1]] + dp2[(i + 1) % 2][j]) % MOD;
    }
    ll r = 0;
    for(int i = (s + 1) / 2; i <= s; i++) r = (r + dp[n % 2][i]) % MOD;
    if(s % 2) cout << (modpow(3, n) + MOD * 10 - r * 3) % MOD << endl;
    else cout << (modpow(3, n) + MOD * 10 - r * 3 + dp2[n % 2][s / 2] * 3) % MOD << endl;
}

Measured memory_bytes: 3072
# @author 

import sys

class EColorfulBlocks:
    def solve(self, tc=0):
        import math

        MOD = 998244353

        n, m, k = [int(_) for _ in input().split()]

        if n == 1:
            print(m)
            return

        c = [0] * (n + 1)
        c[1] = 1
        for i in range(2, n + 1):
            c[i] = c[i - 1] * (n - i + 1)
            c[i] *= pow(i - 1, MOD - 2, MOD)
            c[i] %= MOD

        ans = 0
        p_min = n - k # >= 1
        for p in range(p_min, n + 1):
            ans += m * pow(m - 1, p - 1, MOD) * (c[p])
            ans %= MOD

        # if m >= 2:
        #     for p in range(n + 1 - k, n + 1):
        #         ans += m * pow(m - 1, p - 1, MOD) * (pow(m - 2, p + 1, MOD))
        #         ans %= MOD

        print(ans)



solver = EColorfulBlocks()
input = sys.stdin.readline

solver.solve()


Measured memory_bytes: 16732
s = int(input())
a = list(map(int, input().split()))

incFlg = True   #登る場合はTure,　降る場合はFalse
before_height = 0
sum = 0

for i in range(len(a)-1):
    #降る場合
    if a[i] > a[i+1]:
        #その前が登り
        if incFlg:
            sum += a[i] - before_height
            incFlg = False
        #その前が下り
        else:
            before_height = a[i]
    #登る場合
    else:
        if not incFlg:
            before_height = a[i]
        incFlg = True

if incFlg:
    sum += a[len(a)-1] - before_height

print(sum)


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

int main() {
    int n;
    long long int ans = 0;
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        if(i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<cmath>
using namespace std;
int main()
{
	int a,b,c,d;
	while(cin>>a>>b>>c>>d)
	{
		if(c>b||d<a)
		{
			printf("0\n");
		}
		else
		{
			if(b>d)
			{
				if(a>c)
				printf("%d\n",d-a);
				else
				printf("%d\n",d-c);
			}
			else
			{
				if(a>c)
				printf("%d\n",b-a);
				else
				printf("%d\n",b-c);
			}
		}
		
	}
	return 0;
}
 

Measured memory_bytes: 256
import java.util.*;
class Main{
public static void main(String args[])
{

  Scanner s=new Scanner(System.in);
  //int t=s.nextInt();
  double d=s.nextDouble();
  double t=s.nextDouble();
  double sp=s.nextDouble();  
   double time=d/sp;
  if(time>t)
    System.out.println("No");
  else
    System.out.println("Yes");


  
  
}
  
}


Measured memory_bytes: 37176
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp69 {
    class Program {
        static void Main(string[] args) {
            string A = Console.ReadLine();
            int keta_A = A.Length;

            string B = Console.ReadLine();
            int keta_B = B.Length;

            if (keta_A > keta_B) {
                Console.WriteLine("GREATER");
                return;
            } else if (keta_A < keta_B) {
                Console.WriteLine("LESS");
                return;
            }

            for (int i = 0; i < keta_A; i++) {
                int a = int.Parse(A[i].ToString());
                int b = int.Parse(B[i].ToString());

                if (a > b) {
                    Console.WriteLine("GREATER");
                    return;
                } else if (a < b) {
                    Console.WriteLine("LESS");
                    return;
                }

                if (i == keta_A - 1 && a == b) {
                    Console.WriteLine("EQUAL");
                }
            }



        }
    }
}


Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Class12
    {
        static void Main()
        {
            var S = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(LCM(S[0], S[1]));
        }
        static long GCD(long a,long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }
        static long LCM(long a,long b)
        {
            return a * b / GCD(a, b);
        }
        
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
// template<class t, class u>
// ostream& operator<<(ostream& os, const pair<t, u>& p) {
//   return os << "{" << p.first << ", " << p.second << "}";
// }
// template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
//   os << "{";
//   rep(i, v.size()) { if(i) os << ", "; os << v[i]; }
//   return os << "}";
// }
// template<class t> ostream& operator<<(ostream& os, const set<t>& se) {
//   os << "{";
//   auto itr = se.begin();
//   rep(i, se.size()) { if(i) os << ", "; os << *itr; itr++; }
//   return os << "}";
// }
// template<class t, class u>
// ostream& operator<<(ostream& os, const map<t, u>& mp) {
//   os << "{";
//   auto itr = mp.begin();
//   rep(i, mp.size()) { if(i) os << ", "; os << *itr; itr++; }
//   return os << "}";
// }
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {

  ll N, M;
  cin >> N >> M;
  vector<ll> s(M), c(M);
  REP(i, 0, M) {
    cin >> s[i];
    cin >> c[i];
  }

  ll num[N];
  REP(i, 0, N) {
    num[i] = -1;
  }
  REP(i, 0, M) {
    if (num[s[i] - 1] == -1 or num[s[i] - 1] == c[i]) {
      num[s[i] - 1] = c[i];
    }
    else {
      cout << -1 << endl;
      return 0;
    }
  }

  if (N == 1 and M == 0) {
    cout << 0 << endl;
    return 0;
  }

  // 0 -1 -1 is invalid
  // -1 -1 0 is valid (e.g. 1 0 0)
  // -1 -1 -1 is valid (e.g. 1 0 0)
  if (num[0] == 0){
    if (N != 1) {
      cout << -1 << endl;
      return 0;
    }
    else { // N == 1
      cout << 0 << endl;
      return 0;
    }
  }

  // calc ans
  // -1 2 -1 -> 1 2 0
  bool number_exist = false;
  REP(i, 0, N) {
    if (num[i] == -1){
      if (number_exist == true) {
        cout << 0;
      }
      else {
        cout << 1;
        number_exist = true;
      }
    }
    else {
      cout << num[i];
      number_exist = true;
    }
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL =LONG_LONG_MAX;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

ll gcb(ll a, ll b){/// ユークリッドの互除法: O(log)
    
    if(b == 0) return a;
    
    return gcb(b,a%b);
}


ll lcm(ll a, ll b){
    
    return  a/gcb(a,b) * b; ///gcbは約数
}


int main() {
    int n,a,b;cin>>n>>a>>b;
    
    if( abs(a-b)%2==0)cout<<"Alice"<<endl;
    else cout<<"Borys"<<endl;
    
    return 0;
}








Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    int prev = -1;
    int num = 0;
    int ans = 0;
    rep(i, 0, N)
    {
        int a;
        cin >> a;
        if (a != prev)
        {
            ans += num / 2;
            prev = a;
            num = 1;
        }
        else
        {
            ++num;
        }
    }
    ans += num / 2;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;

const int MAX = 100001;
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
   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[mod%i] * (mod / i) % mod;
       finv[i] = finv[i - 1] * inv[i] % mod;
   }
}
 
long long COM(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;
}

int main ()
{
  prep();
  COMinit();
  int n, k;
  cin >> n >> k;
  int arr[n];
  set<int> st;
  map<int, int> freqs;
  for (int i=0; i<n; i++){
      cin >> arr[i];
      st.insert(arr[i]);
      freqs[arr[i]]++;
  }
  set<int>::iterator it = st.begin();
  int last = 0;
  long long sum = 0;
  int cnt = 0;
  while (it != st.end()){
      long long num = *it;
      // how many is this minimum
      
      int myfreq = freqs.find(num)->second;
      int abovecnt = n-cnt;
      sum -= num*mymod(COM(abovecnt, k)-COM(abovecnt-myfreq, k));
      sum = mymod(sum);
      // how many is this maximum
      int belowcnt = cnt+myfreq;
      sum += num*mymod(COM(belowcnt, k)-COM(belowcnt-myfreq, k));
      sum = mymod(sum);
      //cout << num << " " << mymod(COM(abovecnt, k)-COM(abovecnt-myfreq, k)) << " " << mymod(COM(belowcnt, k)-COM(belowcnt-myfreq, k)) << endl;
      //cout << abovecnt << " " << belowcnt << endl;
      it++;
      cnt += myfreq;
  }
  cout << sum;
  return 0; 
}

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

int main() {
   int n;
   cin >> n;
   int ans=0;
   for(int i=1;i<=n;i++){
      int cnt=0;
      if(i%2==1){
         for(int j=1;j<=n;j++){
            if(i%j==0)
            cnt++;
         }
         if(cnt==8)
         ans++;
      }
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
  int K, N;

  cin >> K >> N;

  vector<int> a(N);
  int max_dist = 0;
  int max_index = 0;
  int clock = true;
  for (int i = 0; i < N; ++i) {
    int tmp;
    cin >> tmp;
    a[i] = tmp;
    int diff = a[i] - a[i - 1];
    if (i > 0) {
      if (diff > max_dist) {
        max_dist = diff;
        max_index = i;
      }
    }
    if (i == N - 1) {
      diff = a[0] + (K - a[i]);
      if (diff > max_dist) {
        max_dist = diff;
        max_index = i;
        clock = false;
      }
    }
  }

 cout << K - max_dist << endl;

  return 0;
}

Measured memory_bytes: 1152
from itertools import accumulate

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


As = list(accumulate(A))
Bs = list(accumulate(B))

ans = 0
idx = M-1
for i in range(N):    
    if As[i] > K:  
        break
    while idx != -1 and As[i] + Bs[idx] > K:
        idx -= 1
    num = i + idx + 2
    ans = max(ans, num)

for i in range(M):
    if Bs[i] <= K:
        ans = max(ans, i+1)
print(ans)

Measured memory_bytes: 48720
#include<iostream>

using namespace std;

int main(){
  int N;

  cin >> N;

  for(int i=1; i<=9; i++){
    for(int j=1; j<=9; j++){
      if(i*j == N){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
  return 0;
}

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

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            var ac = 0L;
            var wa = 0L;
            var tle = 0L;
            var re = 0L;
            for (int i = 0; i < N; i++)
            {
                var S = ReadText();
                switch (S)
                {
                    case "AC": ac++; break;
                    case "WA": wa++; break;
                    case "TLE": tle++; break;
                    case "RE": re++; break;
                }
            }

            var sb = new StringBuilder();
            sb.AppendLine($"AC x {ac}");
            sb.AppendLine($"WA x {wa}");
            sb.AppendLine($"TLE x {tle}");
            sb.AppendLine($"RE x {re}");

            return sb.ToString().Trim();
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 30460
Module Program
  Sub Main
    Dim s = GetInts()
    Dim a=s(0),b=s(1),c=s(2)
    Dim ans=If(a>c Or a+b<c,"NO","YES")
    Console.WriteLine(ans)
  End Sub
  
  '/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  Function Gets() As String()
    Gets = Console.ReadLine().Split(" "c)
  End Function
  Function GetInts() As Integer()
    Dim s = Gets(), r(UBound(s)) As Integer
    For i As Integer=0 To UBound(s): r(i)=s(i): Next i
    GetInts = r
  End Function
End Module

Measured memory_bytes: 20304
N = int(input())
A = []
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        a = i
        b = N//i
        if a>b:
            a,b = b,a
        if 0<a<b-1:
            A.append(b-1)
print(sum(A))

Measured memory_bytes: 64480
#include<stdio.h>
#include<algorithm>
using namespace std;
long long p[1100];
long long q[1100];
long long r[1100];
int ABS(int a){
	return max(a,-a);
}
int main(){
	int a,b,c,d,e,f,g;
	scanf("%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g);
	for(int i=0;i<a;i++)p[ABS(i-d)%g]++;
	for(int i=0;i<g;i++){
		int s=(e+1+g-i-1)/g;
		int t=(b-e+g-i-1)/g;
		for(int j=0;j<g;j++)q[(i+j)%g]+=p[j]*(s+t);
	}
	for(int i=0;i<g;i++)q[i]-=p[i];
	for(int i=0;i<g;i++){
		int s=(f+1+g-i-1)/g;
		int t=(c-f+g-i-1)/g;
		for(int j=0;j<g;j++)r[(i+j)%g]+=q[j]*(s+t);
	}
	for(int i=0;i<g;i++)r[i]-=q[i];
	for(int i=0;i<g;i++){
		if(i)printf(" ");
		printf("%lld",r[i]);
	}
	printf("\n");
}

Measured memory_bytes: 1056
n, C = map(int, input().split())
T = 10**5
channel = []
recorder = [0 for _ in range(2*T+1)]
for loop in range(n):
    s, t, ch = map(int, input().split())
    channel.append([s, t, ch-1])

for c in range(C):
    time = [0 for _ in range(2*T+1)] # 0.5秒刻み
    for i in range(n):
        s, t, ch = channel[i]
        if ch == c:
            time[2*s-1] += 1
            time[2*t] -= 1
    for t in range(1, 2*T+1):
        time[t] += time[t-1]
    for t in range(2*T+1):
        if time[t] > 0:
            recorder[t] += 1
ans = 0
for t in range(2*T+1):
    ans = max(ans, recorder[t])
print(ans)


Measured memory_bytes: 118860
while True:
    a, op, b=input().split()
    a=int(a)
    b=int(b)
    if op=='+':
        print(a+b)
    elif op=='-':
        print(a-b)
    elif op=='*':
        print(a*b)
    elif op=='/':
        print(a//b)
    else :
        break




Measured memory_bytes: 5596
xp1, yp1, xp2, yp2 = map(int, input().split())
q = int(input())

xp = complex(xp2 - xp1, yp2 - yp1)
x1 = complex(xp1, yp1)

for _ in range(q):
    x, y = map(int, input().split())
    xpi = complex(x - xp1, y - yp1)
    dot = xp.real * xpi.real + xp.imag * xpi.imag
    ans = x1 + dot * xp / (abs(xp) ** 2)
    print("{:.9f} {:.9f}".format(ans.real, ans.imag))



Measured memory_bytes: 5640
#![allow(non_snake_case)]
#![allow(unused_variables)]

fn main() {
    let (N, A, B): (i64, i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let ans = std::cmp::min(N * A, B);

    println!("{}", ans);
}


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll n,q,k,d;

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

  cin>>n>>q>>k>>d;
  k--;d--;
  ll crt=d;
  rep(i,q)crt=(crt*2)%n;
  ll rest=(k-crt+n)%n;
  if(q<60&&rest>=(1LL<<q)){
    cout<<-1<<endl;
    return 0;
  }

  vector<ll> mv(q,0);
  rep(i,60){
    if((rest>>i)&1)mv[i]=1;
  }

  vector<ll> res(q);
  crt=d;
  for(ll i=q-1;i>=0;i--){
    if(crt<n/2) res[i]=mv[i];
    else res[i]=1-mv[i];
    crt=(crt*2+mv[i])%n;
  }
  assert(crt==k);
  rep(i,q)cout<<res[i]<<endl;

  return 0;
}



Measured memory_bytes: 16960
x,y=map(int,input().split())
s=0
if x==1:
    s+=300000
elif x==2:
    s+=200000
elif x==3:
    s+=100000
if y==1:
    s+=300000
elif y==2:
    s+=200000
elif y==3:
    s+=100000
if x==1 and y==1:
    s+=400000
print(s)

Measured memory_bytes: 38384
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    long[] val = new long[N];
    long sum = 0;
    for(int i = 0; i < N; i++){
      val[i] = Integer.parseInt(sc.next());
      sum += val[i];
    }
    
    long ans = Long.MAX_VALUE;
    long now = 0;
    for(int i = 0; i < N-1; i++){
      now += val[i];
      long dis = Math.abs(sum-now*2);
      if(dis < ans){
        ans = dis;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 52140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>

using namespace std;

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

    vector<int> a(n);

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

    reverse(a.begin(), a.end());

    cout << a[0];
    for (int i = 1; i < n; i++)
    {
        cout << " " << a[i];
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
double pi=3.141592653589;
int main() {
  cout<<setprecision(10);
  double a,b,x; cin>>a>>b>>x;
  double t;
  if(2*x>a*a*b){
    t=2*(b/a-x/(a*a*a));
  }
  else{t=a*b*b/(2*x);}
  cout<<atan(t)*180/pi;
}

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

struct UnionFind
{
 vector<int> par;
 vector<int> rank;
 vector<int> size;
 int n;

 UnionFind(int N){
     n=N;
     par.resize(n);
     rank.resize(n);
     size.resize(n);
     for(int i=0;i<n;i++){
         par[i]=i;
         rank[i]=0;
         size[i]=1;
     }
 }

 int find_set(int u)
 {
  if(u==par[u]) return u;
  par[u]=find_set(par[u]);
  return par[u];
 }

 bool same(int u,int v)
 {
  return find_set(u)== find_set(v);
 }

 void unite(int u,int v)
 {
  u=find_set(u);
  v=find_set(v);

  if(u==v){
      return;
  }
  if (rank[u]>rank[v]){
      par[v]=u;
      size[u]+=size[v];
  }
  else{
      par[u]=v;
      size[v]+=size[u];
      if(rank[u]==rank[v]){
          rank[v]++;
      }
  }
 }

 void update_par(void)
 {
  for(int i=0;i<n;i++){
      find_set(i);
  }
 }

 int get_size(int u)
 {
  return size[find_set(u)];
 }

};     // structのあとこれ忘れないようにする

int main()
{
 int N,M; cin >> N >> M;
 UnionFind uf(N);
 for(int i=0;i<M;i++){
     int A_i,B_i; cin >> A_i >> B_i;
     A_i-=1;
     B_i-=1;
     uf.unite(A_i,B_i);
 }
 int ans = 0;
 for(int i=0;i<N;i++){
     int tmp = uf.get_size(i);
     if(ans < tmp) ans = tmp;
 }
 cout << ans << endl;
 return 0;
}

Measured memory_bytes: 5624
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

pair<int, bool>H[100010];
int N,M;
int A, B;
int sum, ans, cnt;
string S;

int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		cin >> H[i].first;
		H[i].second = true;
	}

	ans = N;

	for (int i = 1; i <= M; i++) {
		cin >> A >> B;
		if (H[A].first < H[B].first) {
			if (H[A].second != false) {
				H[A].second = false;
				cnt++;
			}
		}
		else if (H[A].first > H[B].first) {
			if (H[B].second != false) {
				H[B].second = false;
				cnt++;
			}
		}
		else if (H[A].first == H[B].first) {
			if (H[A].second != false) {
				H[A].second = false;
				cnt++;
			}
			if (H[B].second != false) {
				H[B].second = false;
				cnt++;
			}
		}
	}

	cout << ans - cnt << endl;

	return 0;
}

Measured memory_bytes: 4408
#include <bits/stdc++.h>
using namespace std;
int n;
int a[110];
int main() {
	cin>>n;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) {
		if(a[i]&1) continue;
		if(a[i]%3!=0 && a[i]%5!=0) {
			printf("DENIED\n");
			exit(0);
		}
	}
	printf("APPROVED\n");
	return 0;
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define FOREACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIGN(x) (((x)>0)?1:(((x)<0)?-1:0))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
#define vv(t) vector< t > 
#define CHC(mp, x) if(mp.end() != mp.find(x))
#define CHCV(mp, x) if(mp.end() != find(ALL(mp), x))
template<typename T>
inline T lcm(T a, T b) {return a / __gcd(a, b) * b;}
#define fi first
#define se second
#define el endl
#pragma endregion


void Main();
void solve(long long N, long long Q, std::vector<long long> a, std::vector<long long> b, std::vector<long long> p, std::vector<long long> x);

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    long long N;
    scanf("%lld",&N);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    std::vector<long long> p(Q);
    std::vector<long long> x(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&p[i]);
        scanf("%lld",&x[i]);
    }
    solve(N, Q, std::move(a), std::move(b), std::move(p), std::move(x));
}

bool seen[2*100000+1]={};
void dfs(vector<pair<vector<int>, int> >& gp, int now, int num){
    if(seen[now])
        return;
    seen[now]=true;
    num+=gp[now].se;
    gp[now].se=num;
    FOREACH(i, gp[now].fi){
        dfs(gp, i, num);
    }
}

void solve(long long N, long long Q, std::vector<long long> a, std::vector<long long> b, std::vector<long long> p, std::vector<long long> x){
    vector<pair<vector<int>, int> > gp(N+1);
    REP(i, N-1){
        gp[a[i]].fi.push_back(b[i]);
        gp[b[i]].fi.push_back(a[i]);
    }
    REP(i, Q){
        gp[p[i]].se+=x[i];
    }
    dfs(gp, 1, 0);
    FOR(i, N+1, 1){
        cout << gp[i].se;
        if(i!=N)
            cout << " ";
    }
    cout << el;
}



Measured memory_bytes: 30720
#include "bits/stdc++.h"

#define sai(j,n) for(sei j=0;j<sei(n);++j)
#define gsai(j,n) for(sei j=sei(n)-1;j>=0;--j)
#define kan(j,m,n) for(sei j=m;j<sei(n);++j)
#define gkan(j,m,n) for(sei j=sei(n)-1;j>=sei(m);--j)
#define zen(h) (h).begin(),(h).end()
#define yu(h) v.erase(unique(zen(h)), h.end());
#define mugen 10000000111
#define yo 10000000711
#define kyo 1e-9
#define datu break
#define saiki(a) while(a)
#define seiri(h) sort(zen(h))
#define sin() main()
#define hen return
#define nyu(a) cin >> a
#define syutu(a) cout << a << endl
#define ru(a) if(a)
#define ta else
#define ruguo(a) else if(a)

using namespace std;
typedef int seisu;
typedef void mu;
typedef long long sei;
typedef long double xyo;
typedef vector<sei> hs;
typedef vector<xyo> hx;
typedef vector<hs> hhs;
typedef vector<hx> hhx;
typedef pair<sei, sei> so;
typedef vector<so> hso;
typedef bool singi;

const seisu h1[8] = {1,1,0,-1,-1,-1,0,1};
const seisu h2[8] = {0,1,1,1,0,-1,-1,-1};

sei dai(sei a, sei b){return max(a,b);}
sei syo(sei a, sei b){return min(a,b);}

sei n;
hs a(110);
sei iti;
sei su;
sei kai = 0;

mu syu(sei b){
    iti = b;
    ru(a[b] == a[b+1]){
        su++;
        syu(b+1);
    }
}

seisu sin(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    nyu(n);

    sai(j,n){
        nyu(a[j]);
    }

    for(iti=0;iti<n;iti++){
        su = 1;
        syu(iti);
        ru(su>1 && su%2 == 0){
            kai += su/2;
        }
        ruguo(su>1 && su%2 == 1){
            kai += (su-1)/2;
        }
    }

    syutu(kai);
    hen 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define INF (1e9)
#define J 2000
#define N 50
using namespace std;
int main(){
  int n,c[N],dp[J],dn[J],C=0;
  while(1){
    cin>>n;
    if(!n) break;
    for(int i=0;i<n;i++) cin>>c[i];
    for(int i=0;i<J;i++) dp[i]=dn[i]=INF;
    sort(c,c+n);
    dp[0]=0;
    for(int i=0;i<n;i++)
      for(int j=1;j<J;j++)
	if(j>=c[i]) dp[j]=min(dp[j],dp[j-c[i]]+1);
    sort(c,c+n);
    reverse(c,c+n);
    for(int i=0;i<J;i++){
      int cnt=0,sum=i;
      for(int j=0;j<n;j++){
	cnt+=sum/c[j];
	sum%=c[j];
      }
      if(sum==0) dn[i]=cnt;
    }
    int flag=0;
    for(int i=1;i<J;i++){
      if(dp[i]==INF||dn[i]==INF){
	flag=1;
	break;
      }
      if(dp[i]!=dn[i]){
	flag=2;
	break;
      }
    }
    C++;
    cout<<"Case #"<<C<<": ";
    if(!flag) cout<<"OK"<<endl;
    else if(flag==1) cout<<"Cannot pay some amount"<<endl;
    else cout<<"Cannot use greedy algorithm"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1196
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main { 
	public static void main(String[] args) throws Exception { 
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		int[] trump = new int[n];
		int i = 0;
		String line;
		for(int u = 0 ; u < n ;u++){
			line = in.readLine();
			trump[i] = Integer.parseInt(line);
			i++;
		}
		
		boolean isok = true;
		
		for(int j = 0 ; j < n ; j++){
			if(trump[j] < 10){
				if(j == 0){
					isok = false;
				}else{
					for(int k = j - 1 ; k >= 0 ; k--){
						if(trump[k] >= (j-k+1)*10){
							isok = true;
							break;
						}else{
							isok = false;
						}
					}
				}
									if(!isok) break;
			}
		}
		if(isok){
			int[] trumpreturn = new int[n];
			for(int y = 0 ; y < n ; y++){
			trumpreturn[y] = trump[n-y-1];
			}
			for(int j = 0 ; j < n ; j++){
				if(trumpreturn[j] < 10){
					if(j == 0){
						isok = false;
					}else{
						for(int k = j - 1 ; k >= 0 ; k--){
							if(trumpreturn[k] >= (j-k+1)*10){
								isok = true;
								break;
							}else{
								isok = false;
							}
						}
					}
										if(!isok) break;
				}
			}
		}
		
		
		String judge;
		if(isok){
			judge = "yes";
		}else{
			judge = "no";
		}
		
			System.out.println(judge);
	}
} 


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

int main(){
	int ad[4],ef[2];
	for(int i=0;i<4;i++)cin>>ad[i];
	for(int i=0;i<2;i++)cin>>ef[i];
	sort(ad,ad+4);
	sort(ef,ef+2);
	cout<<ad[1]+ad[2]+ad[3]+ef[1]<<endl;
	return 0;
}

Measured memory_bytes: 3128
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] line = br.readLine().split(" ");
        long n = Long.parseLong(line[0]);
        int x = Integer.parseInt(line[1]), m = Integer.parseInt(line[2]);

        bw.write(Long.toString(solve(n, x, m)));

        bw.close();
        br.close();
    }

    private static long solve(long n, int x, int m) {
        long[] prefix = new long[m + 1];
        int arr[] = new int[m],  a = x % m, index = 0;
        Arrays.fill(arr, -1);

        while (arr[a] == -1) {
            arr[a] = index++;
            prefix[index] = prefix[index - 1] + a;
            a = (int)((long)a * a % m);
        }

        int start = arr[a], end = index;

        return (n - start) / (end - start) * (prefix[end] - prefix[start]) + prefix[start + (int)((n - start) % (end - start))];
    }
}


Measured memory_bytes: 33936
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <unordered_map>
using namespace std;


int main() {
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (x + r <= W && x - r >= 0 && y + r <= H && y - r >= 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 1160
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)

ans = sum(p[:x] + q[:y])
i = x-1
j = y-1

for k in r:
    if i >= 0 and j >= 0:
        if p[i] <= q[j] and p[i] < k:
            ans += k - p[i]
            i -= 1
            continue
        elif p[i] > q[j] and q[j] < k:
            ans += k - q[j]
            j -= 1
            continue
    elif i == -1 and j >= 0:
        if q[j] < k:
            ans += k - q[j]
            j -= 1
            continue
    elif i >= 0 and j == -1:
        if p[i] < k:
            ans += k - p[i]
            i -= 1
            continue
    break
print(ans)


Measured memory_bytes: 105544
# coding:utf-8

import sys
from collections import Counter


input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


N = int(input())

ans = 0
for s in str(N):
    if s == '2':
        ans += 1

print(ans)


Measured memory_bytes: 3828
import math

a, b, x = map(float, input().split())

if x > (a ** 2) * b / 2:
    tan_theta = 2 * ((a ** 2) * b - x) / (a ** 3)
else:
    tan_theta = a * (b ** 2) / (2 * x)

theta = math.degrees(math.atan(tan_theta))

print(theta)


Measured memory_bytes: 2940
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
int MIN(int x, int y){return x<y?x:y;}
int compare_longlong(const void *a, const void *b) {long long *A = (long long *)a;long long *B = (long long *)b;if (*A > *B) return 1;if (*A < *B) return -1;return 0;}

typedef struct{
	int x,y;
	bool use;
}point;

int comp(const void *a, const void *b){return ((point*)a)->x - ((point*)b)->x;}

int main(void){
	int n;
	scanf("%d",&n);
	point red[n],blue[n];
	for(int i=0;i<n;i++)scanf("%d%d",&red[i].x,&red[i].y);
	for(int i=0;i<n;i++)scanf("%d%d",&blue[i].x,&blue[i].y);
	for(int i=0;i<n;i++)red[i].use = blue[i].use = false;
	qsort(red,n,sizeof(point),comp);
	qsort(blue,n,sizeof(point),comp);
	for(int i=0;i<n;i++){
		bool first=false;
		int index=-1;
		for(int j=0;j<n;j++){
			if(!red[j].use && red[j].y<blue[i].y && red[j].x<blue[i].x && !first){
				index=j;
				first=true;
			}
			if(!red[j].use && red[j].y<blue[i].y && red[j].x<blue[i].x && first){
				if(red[index].y<red[j].y)index=j;
			}
		}
		if(index>=0)red[index].use = true;
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(red[i].use)ans++;
	}
	printf("%d",ans);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    string S="ACTG";
    string fin;
    getline(cin,fin);
    int maxs=0;
    int num=0;
    for(int i=0;i<fin.length();i++)
    {
        bool flag=false;
        for(int it=0;it<4;it++)
        {
            if(fin[i]==S[it])
            {
                flag=true;
                break;
            }
        }
        if(flag)
        {
            num++;
        }
        else
        {
            maxs=max(num,maxs);
            num=0;
        }
    }
    maxs=max(num,maxs);
    cout<<maxs<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define nord 100
int main() { 
   int A[nord][nord];
   int n, vi, vj, k;
   int i, j;

   scanf("%d", &n);

   for (i = 0; i < n; ++i) {
	  for (j = 0; j < n; ++j) {
		 A[i][j] = 0;
	  }
   }

   for (i = 0; i < n; ++i) {
	  scanf("%d", &vi);
	  scanf("%d", &k);
	  j = 0;
	  while (j < k) {
		 scanf("%d", &vj);
		 A[vi - 1][vj - 1] = 1;	
		 ++j;
	  }
   }

   for (i = 0; i < n; ++i) {
	  for (j = 0; j < n; ++j) {
		 printf("%d", A[i][j]);
		 if (j != n - 1)
			putchar(' ');
	  }
	  putchar('\n');
   }
   return 0;
}

Measured memory_bytes: 1820
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	int n,W;
	cin>>n>>W;
	ll dp[W+1];
	ll val,w;
	for(int i=0;i<=W;i++)
	dp[i]=0;
	for(int i=0;i<n;i++)
	{
		cin>>w>>val;
		for(int j=W;j>=w;j--)
		dp[j]=max(dp[j],val+dp[j-w]);
	}
	cout<<dp[W];
}
	

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

#define ll long long
const int mod = 1e9 + 7;


struct Node {
  Node(int weight, int solid, int val)
  {
    this->weight = weight;
    this->solid = solid;
    this->val = val;
  }
  int weight;
  int solid;
  int val;
};

vector<Node> arr;
ll int dp[1005][10005];


bool cmp(Node n1, Node n2)
{
  if(n1.solid + n1.weight < n2.solid + n2.weight)
    return true;
  return false;
}


ll int kil(int idx, int weight)
{
  if(weight >=10005)
    return 0;

  if(idx == arr.size())
    return 0;

  if(dp[idx][weight] != -1)
    return dp[idx][weight];

  dp[idx][weight] = 0;  
  dp[idx][weight] = max(dp[idx][weight], kil(idx+1, weight));
  if(arr[idx].solid >= weight)
    dp[idx][weight] = max(dp[idx][weight], kil(idx+1, weight + arr[idx].weight) + arr[idx].val);

  return dp[idx][weight];
}


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

  memset(dp, -1, sizeof dp);
  int n, x, y, z;
  cin>>n;

  for(int i=0;i<n;i++)
  {
    cin>>x>>y>>z;
    arr.push_back(Node(x, y, z));
  }

  sort(arr.begin(), arr.end(), cmp);

  cout<<kil(0, 0)<<endl;

  return 0;
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;  typedef pair<int,ll> pii;
typedef vector<int> VI; typedef vector<ll> VL;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n);
	rep(i,n) cin >>a[i];
	/*
	VI b;
	rep(i, n){
		b.push_back(a[i]);
		reverse(all(b));
	}
	for(auto x :b) printf("%d ",x); puts("");
	*/
	deque<int> q;
	rep(i, n){
		if((i+n)%2) q.push_front(a[i]);
		else q.push_back(a[i]);
	}
	rep(i, n) cout <<(i? " ":"") <<q[i];
	cout <<endl;
	return 0;
}

Measured memory_bytes: 4348
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();

        int a[] = new int [m];
        for (int i = 0; i < m; i++) {
            a[i] = in.nextInt();
        }

        long step[] = new long[n + 3];
        Arrays.fill(step, 0);
        for (int i = 0; i < m; i++) {
            step[a[i]] = -1;
        }

        step[0] = 1;
        for (int i = 0; i <= n; i++) {
            if (step[i] == -1) continue;
            if (step[i + 1] != -1) step[i + 1] = modadd(step[i + 1], step[i], MOD);
            if (step[i + 2] != -1) step[i + 2] = modadd(step[i + 2], step[i], MOD);
        }

        System.out.println(step[n]);
    }

    static final long MOD = 1_000_000_007;    

    static long modadd(long a, long b, long mod) {
        return (a + b) % mod;
    }
}

Measured memory_bytes: 48108
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

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

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)malloc(sizeof(int)*3*n);
  int i;
  for(i=0;i<3*n;i++) scanf("%d",a+i);
  qsort(a,3*n,sizeof(int),cmp);
  int64 sum=0;
  for(i=3*n-2;i>=n;i-=2) sum+=a[i];
  printf("%lld\n",sum);
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 2556
#input
import sys
imput = sys.stdin.readline
def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    dp = [1] * N
    for _ in range(M):
        A, B = map(int, input().split())
        if H[A-1] > H[B-1]:
            dp[B-1] = 0
        elif H[A-1] < H[B-1]:
            dp[A-1] = 0
        elif H[A-1] == H[B-1]:
            dp[A-1] = 0
            dp[B-1] = 0

#output
    print(sum(dp))

if __name__ == "__main__":
    main()

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

int main() {
    int A[3][3];
    rep(i, 3) rep(j, 3) cin >> A[i][j];
    int N;
    cin >> N;
    int B[N];
    rep(i, N) {
        cin >> B[i];
        rep(j, 3)rep(k, 3) if(A[j][k] == B[i]) A[j][k] = 0;
    }
    rep(i, 3) {
        int sum = 0;
        rep(j, 3) {
            sum += A[i][j];
        }
        if (sum == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    rep(i, 3) {
        int sum = 0;
        rep(j, 3) {
            sum += A[j][i];
        }
        if (sum == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    int sum = 0;
    rep(i, 3) {
        sum += A[i][i];
    }
    if (sum == 0) {
        cout << "Yes" << endl;
        return 0;
    }
    sum = 0;
    rep(i, 3) {
        sum += A[i][2-i];
    }
    if (sum == 0) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, n) for (int i = (n)-1; i >= 0; i--)
#define pp(v) cout << #v "=" << (v) << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
using namespace std;

int main() {
  int d,g; cin >> d >> g; g /= 100;
  vector<int> p(d), c(d);
  rep(i,d) {
    cin >> p[i] >> c[i];
    c[i] /= 100;
  }

  int ans = 1e6;
  rep(bit, 1<<d) {
    int sum = 0, cnt = 0;
    rep(i,d) if (bit >> i & 1) {
      sum += p[i] * (i + 1) + c[i];
      cnt += p[i];
    }

    int rest = -1;
    rep(i,d) if (~bit >> i & 1) rest = i;

    if (sum >= g) {
      ans = min(ans, cnt);
      continue;
    }

    if (rest == -1) continue;

    int need = div_ceil(g - sum, rest + 1);
    if (need < p[rest]) {
      cnt += need;
      ans = min(ans, cnt);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256