akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstring>

using namespace std;

const int N = 60;
const int MOD = 1000000007;

int n;
char s1[N], s2[N];
int dp[N][4][4];

int dfs(int n, int c1, int c2)
{
    if (dp[n][c1][c2] != -1)
        return dp[n][c1][c2];
    if (n == 0) {
        return 1;
    }
    long long ans = 0;
    if (s1[n - 1] == s2[n - 1]) {
        for(int c = 1; c <= 3; ++ c) {
            if (c != c1 && c != c2) {
                ans += dfs(n - 1, c, c);
            }
        }
    } else {
        for(int nc1 = 1; nc1 <= 3; ++ nc1) {
            if (nc1 == c1) continue;
            for(int nc2 = 1; nc2 <= 3; ++ nc2) {
                if (nc2 == c2 || nc2 == nc1) continue;
                ans += dfs(n - 2, nc1, nc2);
            }
        }
    }
    dp[n][c1][c2] = ans % MOD;
    return ans % MOD;
} 

void solve()
{
    int n;
    cin >> n;
    scanf("%s%s", s1, s2);
    memset(dp, -1, sizeof dp);
    cout << dfs(n, 0, 0) << endl;
}

int main()
{
    solve();
    return 0;
}


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

int main()
{
    int a, b;
    cin >> a >> b;

    vector<int> a_prices;
    int tmp;
    for(int i = 13; i <= 1250; i++)
    {
        tmp = i * 8 / 100;
        if(tmp == a) a_prices.push_back(i);
        if(tmp > a) break;
    }

    bool frag = true;
    for(int &x: a_prices)
    {
        if(b == x * 10 / 100)
        {
            cout << x << endl;
            frag = false;
            break;
        }
    }
    if(frag) cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
// 
	#include<bits/stdc++.h> 
	#include <sstream> 
	using namespace std; 
	typedef long long ll;
	inline bool cmp(pair< ll , ll > &a , pair< ll , ll >  &b){
		if(a.first != b.first)
			return a.first > b.first;
		else
			return a.second < b.second;
	}

	int main() 
	{ 
		ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
	    ll a , b;
	    cin >> a >> b;
	    cout << a * b / (__gcd(a , b)) << endl;
	}


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







Measured memory_bytes: 3328
def ex2num():
    while (True):
        r1, r2 = input().split(" ")
        r1 = int(r1)
        r2 = int(r2)
        if (0 == r1) and (0 == r2):
            break
        if r1 < r2:
            print(r1, r2)
        else:
            print(r2, r1)

    return 0

if __name__ == "__main__":
    ret = ex2num()


Measured memory_bytes: 5612
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <iterator>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF 1<<29
#define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back

#if DEBUG
#define _DEBUG(x) cout<<#x<<": "<<x<<endl
#define _DDEBUG(x,y) cout<<#x<<": "<<x<<", "<<#y<<": "<<y<<endl
#else
#define _DEBUG(x) ;
#define _DDEBUG(x,y) ;
#endif

#define ll long long
#define ull unsigned long long
#define MOD 1000000007

/** FOR VECTOR DEBUG */
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
    if ( !v.empty() ) {
        out << '[';
        copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


/* template end */

string solve(string s) {
    string ans = "WA";
    for(auto c : s) {
        if('A' <= c && c <= 'Z' && c != 'A' && c != 'C') {
            return ans;
        }
    }
    if(s[0] == 'A') {
        int cnt = 0;
        for(int i = 2; i < s.length() - 1; i++) {
            if(s[i] == 'C') {
                cnt++;
            }
        }
        if(cnt == 1 && s[s.length() - 1] != 'C') {
            ans = "AC";
        }  
    }
    return ans;
}   


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

    string s;
    cin >> s;

    string ans = solve(s);    
#if DEBUG
    cout << "** RESULT **" << endl; // debug
#endif
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int a,b;
  cin >> a >> b;

  if(a>b) swap(a,b);

  if((b-a)%2) cout << "IMPOSSIBLE" << endl;
  else cout << a + (b-a)/2 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
int main(){int a,b,c;std::string s;std::cin>>a>>b;for(int i=a;i<b+1;++i){s=std::to_string(i);if(s[0]==s[4]&&s[1]==s[3])++c;}std::cout<<c<<"\n";}

Measured memory_bytes: 256
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

# import fractions

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def f(N):
    return math.ceil(N/10)*10


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    R = [ii() for _ in range(5)]

    ret = MAX
    for r in itertools.permutations(R, 5):
        tmp = 0
        for i in range(len(r)):
            if i == 4:
                tmp += r[i]
            else:
                tmp += f(r[i])
        ret = min(tmp, ret)

    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3932
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <cmath>
#include <vector>

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

const int INF = 1e9;

using namespace std;

int main() {
    ostringstream os;
    int r, c;
    cin >> r >> c;
    int a[r+1][c+1];
    REP(i, r+1)
        REP(j, c+1)
            a[i][j] = 0;
    REP(i, r)
        REP(j, c){
            cin >> a[i][j];
            a[i][c] += a[i][j];
            a[r][j] += a[i][j];
            a[r][c] += a[i][j];
        }

    REP(i, r+1){
        REP(j, c)
            cout << a[i][j] << " ";
        cout << a[i][c] << endl;
    }

    return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  string S;
  cin>>S;
  int N=S.size();

  int rest=0;
  rep(i,N) rest+=S[i]-'0';
  
  if(rest%9==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define int long long
#define INT_MAX INT64_MAX
#define INT_MIN INT64_MIN
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define MOD 1000000007
/* DEFINE cout */
#define pln cout << "===============================\n"
#define on cout<<"\n"
#define os cout<<" "
#define o2(a,b) cout<<a<<" "<<b
#define o(a) cout << a
#define bitcount __builtin_popcount
/* DEFINE cout */
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);//fastio
using namespace std;
struct hash_pair { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
bool prime[10000001];
int P=MOD-2;
int factorial[10000001]={0};
int powerFunction(int x,int y){
    int res = 1;
    int p = MOD;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}
void factorialFunction(int maxLimit){
    factorial[0]=1;
    for(int i=1 ; i <= maxLimit ; i++)
        factorial[i]=(factorial[i-1]*i)%MOD;
    return;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
signed main(){
    int n, k;
    cin >> n >> k;
    int arr[n+5];
    int temp = 0;
    for(int i=1; n+1>=i; i++){
        temp += n+2-i;
        arr[i] = temp - (i*(i+1))/2 + 1;
    }
    int ans = 0;
    for(int i=k; n+1>=i; i++){
//        cout << i << '*' << arr[i] << endl;
        ans += arr[i];
        ans %= MOD;
    }
    cout << ans << endl;
}






Measured memory_bytes: 5160
import sys
A,B,K=map(int,input().split())
tmp=B
if((A-K)<0):
    if((B+(A-K)) < 0):
        print('0 0')
        sys.exit()
    else:
        tmp+=(A-K)
        print('0 {}'.format(tmp))

else:
    print('{} {}'.format(A-K,B))




Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
using namespace std;
char m[108][108];
int h, w, n, ni, nj, t;
char c;
void solve(){
	cin >> h >> w;
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			cin >> m[i][j];
			if(m[i][j] == '<' || m[i][j] == '>' || m[i][j] == '^' || m[i][j] == 'v'){
				ni = i; 
				nj = j;
			}
		}
	}
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> c;
		switch(c){
			case 'U':
				m[ni][nj] = '^';
				if(ni > 0 && m[ni-1][nj] == '.'){
					swap(m[ni][nj], m[ni-1][nj]);
					ni--;
				}
				break;
			case 'D':
				m[ni][nj] = 'v';
				if(ni < h - 1 && m[ni+1][nj] == '.'){
					swap(m[ni][nj], m[ni+1][nj]);
					ni++;
				}
				break;
			case 'L':
				m[ni][nj] = '<';
				if(nj > 0 && m[ni][nj-1] == '.'){
					swap(m[ni][nj], m[ni][nj-1]);
					nj--;
				}
				break;
			case 'R':
				m[ni][nj] = '>';
				if(nj < w - 1 && m[ni][nj+1] == '.'){
					swap(m[ni][nj], m[ni][nj+1]);
					nj++;
				}
				break;
			case 'S':
				int dx = 0, dy = 0;         
				int ti = ni, tj = nj;
				if(m[ni][nj] == '^')dx = -1;
				if(m[ni][nj] == 'v')dx = 1;
				if(m[ni][nj] == '>')dy = 1;
				if(m[ni][nj] == '<')dy = -1;
				while(0 <= ti && ti < h && 0 <= tj && tj < w){
					if(m[ti][tj] == '*'){
						m[ti][tj] = '.';
						break;
					}
					if(m[ti][tj] == '#'){
						break;
					}
					ti += dx;
					tj += dy;
				}
				break;
		}
	}
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++)cout << m[i][j];
		cout << endl;
	}
	
}

int main(){
	cin >> t;
	for(int i = 0;i < t;i++){
		if(i)cout << endl;
		solve();
	}
	return 0;
}

Measured memory_bytes: 1156
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)
using namespace std;

bool check(string s, char c) {
    for (auto e : s) {
        if (e != c) {
            return false;
        }
    }
    return true;
}

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

    string s;
    cin >> s;

    int ans = 500;

    REP (i, 26) {
        char target = i + 'a';
        string c = s;
        int subans = 0;
        while (!check(c, target) && (c.size() != 0)) {
            REP (j, c.size()-1) {
                if ((c[j] == target) || (c[j+1] == target)) {
                    c[j] = target;
                } else {
                    c[j] = c[j];
                }
            }
            c.pop_back();
            subans++;
        }
        if (c.size() == 0) subans = 500;
        ans = min(ans, subans);
    }

    cout << ans << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,z,w,x,y,c,d,temp=1;
    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
    if(a%c==0||a%d==0)
        temp=0;
    x=a/c;
    y=b/c;
    z=y-x;
    x=a/d;
    y=b/d;
    y=y-x;
    w=c;
    c=__gcd(c,d);
    c=w*d/c;
    w=a/c;
    x=b/c;
    x=x-w;
    a=b-a;
    a=a+x-y-z+temp;
    printf("%lld",a);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  double r;
  cin >> r;
  printf("%.5lf\n", 2*PI*r);

  return 0;
}


Measured memory_bytes: 3780
#include<stdio.h>
int main(){
	int sec,h,m,s;
	scanf("%d", &sec);
	h = (int) sec / 3600;
	m = (int) (sec - h * 3600 ) / 60;
	s = sec - h * 3600 - m * 60;
	printf("%d:%d:%d\n", h,m,s);
	return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
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 = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int k, a, b;

  cin >> k >> a >> b;

  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }

  cout << "NG" << endl;

  return 0;
}


Measured memory_bytes: 3620
unittest
{
	assert( [ "-9" ].solve == "1011" );
	assert( [ "123456789" ].solve == "11000101011001101110100010101" );
	assert( [ "0" ].solve == "0" );
}



import std.conv;
import std.math;
import std.range;
import std.stdio;

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

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	
	if( n == 0 ) return "0";
	
	auto anss = "";
	while( n != 0 )
	{
		anss ~= abs( n % -2 ).to!( string );
		n = cast( long ) ceil( n / -2.0L );
	}
	return anss.retro.to!( string );
}


Measured memory_bytes: 2876
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
#define vt vector
#define pq priority_queue
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)
// #define multicase
const int MOD = 1e9 + 7;
const int INF = 2e9;
// const int N = ;

int n;

void solve() {
    int T = 1;
  #ifdef multicase
    cin >> T;
  #endif
    for(int tc = 1; tc <= T; tc++) {
        cin >> n;
        cout << n * (n + 1) / 2 << "\n";
    }
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    solve();
    
}

Measured memory_bytes: 3636
#include <stdio.h>
 
int N = 100;
 
void out(int A[], int n){
  int i;
  for (i=0;i<n;i++){
    if (i>0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

void intertionSort(int* A, int n){
  int i, j, key=0;
  for(i = 0; i < n; i++){
    key = A[i];
    j = i-1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;
    out(A,n);
  }
}
 
int main(void){
  int n, i;
  int A[N+1];
  scanf("%d", &n);
 
  for (i=0;i<n;i++) scanf("%d", &A[i]); //data input
  intertionSort(A, n);
 
  return 0;
}

Measured memory_bytes: 604
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split()) 
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

a,b = inm()
print((a*b) if a<=9 and b<=9 else -1)


Measured memory_bytes: 39856
import numpy as np
 
 
N, K = map(int, input().split())
inputs = np.array([int(i) for i in input().split()])
 
dp = np.zeros(N, dtype=int)
for i in range(1, N):
    start = max(0, i-K)
    dp[i] = (dp[start:i] + abs(inputs[i] - inputs[start:i])).min()
 
print(dp[-1])

Measured memory_bytes: 23088
#include <iostream>
using namespace std;
const int N_MAX = 200000;

int main() {
	int n, k;
	cin >> n >> k;
	int A[N_MAX];
	for (int i = 0; i < n; i++) cin >> A[i];
	for (int i = 0; i < k; i++) {
		int table[N_MAX+1] = {0};
		for (int j = 0; j < n; j++) {
			int a = j - A[j], b = j + A[j] + 1;
			if (a < 0) table[0]++;
			else table[a]++;
			if (b >= n) table[n]--;
			else table[b]--;
		}
		bool ok = true;
		A[0] = table[0];
		for (int j = 1; j < n; j++) {
			A[j] = A[j-1] + table[j];
			if (A[j] < n) ok = false;
		}
		if (ok) break;
	}
	for (int i = 0; i < n; i++) {
		cout << A[i];
		if (i < n-1) cout << ' ';
		else cout << endl;
	}
	return 0;
}

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

Measured memory_bytes: 596
import static java.lang.Integer.parseInt;
import static java.lang.System.out;
import java.io.File;
import java.util.Scanner;

public class Main extends BaseExe {

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

    @Override
    protected void execute() throws Exception {
        int time = parseInt(nextLine());
        int h = time / 60 / 60;
        time -= h * 3600;
        int m = time / 60;
        time -= m * 60;
        out.printf("%d:%d:%d\n", h, m, time);
    }
}

abstract class BaseExe {

    private Scanner scan;

    private String inData;

    public void exeSysIn() {
        try (Scanner scan = new Scanner(System.in)) {
            exeCtrl(scan);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void exeFileIn(String inDataPath) {
        try (Scanner scan = new Scanner(new File(inDataPath))) {
            exeCtrl(scan);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void exeCtrl(Scanner scan) throws Exception {
        this.scan = scan;
        execute();
    }

    protected abstract void execute() throws Exception;

    protected String nextLine() {
        return scan.nextLine();
    }

    protected boolean judgeInData() {
        return hasNextLine() && isNotEmptyInData();
    }

    protected boolean hasNextLine() {
        return scan.hasNextLine();
    }

    protected boolean isNotEmptyInData() {
        inData = nextLine();
        return !inData.isEmpty();
    }

    protected String getInData() throws Exception {
        if (inData.isEmpty())
            throw new Exception("inData is Empty.");
        return inData;
    }
}

Measured memory_bytes: 26340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 54;
int a[maxn];
ll dp[maxn][2];
ll min(ll a,ll b){return a<b?a:b;}
ll max(ll a,ll b){return a>b?a:b;}
int main() 
{
	int n,p,sum=0; 
	scanf("%d%d",&n,&p);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),a[i]&=1;
	dp[0][0]=1;
	for(int i=1;i<=n;i++) for(int j=0;j<=1;j++)
		dp[i][j]=dp[i-1][j]+dp[i-1][j^a[i]];
	printf("%lld",dp[n][p]);
    return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        n: usize,
        b_vec: [usize; n-1],
    }

    let mut a_vec: Vec<usize> = vec![0; n];

    for i in 0..n-1 {
        if i == 0 {
            a_vec[i] = b_vec[i];
            a_vec[i+1] = b_vec[i];
        } else {
            if b_vec[i] > b_vec[i-1] {
                a_vec[i+1] = b_vec[i]
            } else {
                a_vec[i+1] = b_vec[i];
                a_vec[i] = b_vec[i];
            }
        }
    }

    println!("{}", a_vec.iter().sum::<usize>());
}


Measured memory_bytes: 2200
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main( void )
{
	// Dynamic Programming
	// dp[àz] = Å¬

	const int coins[6] = { 500, 100, 50, 10, 5, 1 };

	int n;
	while ( cin >> n && n )
	{
		vector <int> dp( (1000-n)+1, 0 );
		for ( int i = 0; i < 6; i++ ) dp[coins[i]] = 1;

		for ( int i = 0; i < (1000-n)+1; i++ )
		{
			if ( dp[i] > 0 )
			{
				for ( int j = 0; j < 6; j++ )
				{
					if ( i + coins[j] < (1000-n)+1 )
					{
						if ( dp[i+coins[j]] == 0 ) dp[i+coins[j]] = dp[i] + 1;
						else dp[i+coins[j]] = min( dp[i+coins[j]], dp[i] + 1 );
					}
				}
			}
		}

		cout << dp[(1000-n)] << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <functional>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						(1000 * 1000 * 1000 * 2)
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int n;
	cin >> n;	
	vector<int> a(n);
	REP(i, n) cin >> a[i];

	if (IsEven(n)) {
		for (int i = n - 1; 1 <= i; i -= 2) {
			cout << a[i] << " ";
		}
		for (int i = 0; i < n; i += 2) {
			cout << a[i] << " ";
		}
	} else {
		for (int i = n - 1; 0 <= i; i -= 2) {
			cout << a[i] << " ";
		}
		for (int i = 1; i < n; i += 2) {
			cout << a[i] << " ";
		}
	}

	cout << endl;

	return 0;
}



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

using namespace std;

using ll=int64_t;

int main()
{
    ll n;
    cin>>n;
    vector<ll>a(n+1);
    vector<ll>b(n);
    for(int i=0;i<=n;i++)
    {
        cin>>a[i];
    }
    vector<ll>t=a;
    for(int i=0;i<n;i++)
    {
        cin>>b[i];
    }

    if(b[0]>=a[0])
    {
        b[0]-=a[0];
        a[0]=0;
    }
    else
    {

        a[0]-=b[0];
        b[0]=0;
    }

    for(int i=1;i<=n;i++)
    {
        if(b[i-1]!=0&&a[i]!=0&&b[i-1]>=a[i])
        {

            b[i-1]-=a[i];
            a[i]=0;
        }
        else if(b[i-1]!=0&&a[i]!=0)
        {
            a[i]-=b[i-1];
            b[i-1]=0;
        }
        if(i!=n&&b[i]!=0&&a[i]!=0&&b[i]>=a[i])
        {

            b[i]-=a[i];
            a[i]=0;
        }
        else if(i!=n&&b[i]!=0&&a[i]!=0)
        {
            a[i]-=b[i];
            b[i]=0;
        }

    }
    ll c=0;

    for(int i=0;i<=n;i++)
    {
        if(a[i]!=t[i])
            c+=abs(a[i]-t[i]);
    }
    cout<<c<<endl;

}


Measured memory_bytes: 2560
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val sx, sy, tx, ty = sc.nextInt()

    // (sx, sy) -> (sx, ty) -> (tx, ty) ->
    // (tx, sy) -> (sx, sy) -> (sx - 1, sy) ->
    // (sx - 1, ty + 1) -> (tx, ty + 1) -> (tx, ty) ->
    // (tx + 1, ty) -> (tx + 1, sy + 1) -> (sx, sy + 1) ->
    // (sx, sy)
    val r =
    ((sy until ty).map(_ => 'U') ++
    (sx until tx).map(_ => 'R') ++
    (sy until ty).map(_ => 'D') ++
    (sx to    tx).map(_ => 'L') ++
    (sy to    ty).map(_ => 'U') ++
    (sx to    tx).map(_ => 'R') ++ Seq('D', 'R') ++
    (sy to    ty).map(_ => 'D') ++
    (sx to    tx).map(_ => 'L') ++ Seq('U')).mkString("")

    println(r)
  }

}


Measured memory_bytes: 30040
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ll h,w,k;
    std::cin >> h>>w>>k;
    
    vector<string> a(h);
    pair<ll,ll> s;
    for (int i = 0; i < h; i++) {
        std::cin >> a[i];
        for (int j = 0; j < w; j++) {
            if(a[i][j]=='S')s = {i,j};
        }
    }
    
    set<pair<ll,ll>> se;
    
    queue<tuple<ll,ll,ll>> q;
    q.push({s.first,s.second,k});
    se.insert({s.first,s.second});
    while(q.size()){
        auto [xx,yy,rem] = q.front();q.pop();
        if(rem==0)continue;
        for (int x = -1, y = 0, iii = 0; iii < 4; x += y, y = x - y, x = y - x, ++iii) {
            if(xx+x<0||xx+x>h-1||yy+y<0||yy+y>w-1)continue;
            if(a[xx+x][yy+y]=='.'){
                if(se.find({xx+x,yy+y})!=se.end())continue;
                if(rem-1>0)q.push({xx+x,yy+y,rem-1});
                se.insert({xx+x,yy+y});
            }
        }
    }
    ll ans = 1e15;
    for (auto e : se) {
        auto minx = min(e.first,h-1-e.first);
        auto miny = min(e.second,w-1-e.second);
        ans = min(ans, (min(minx,miny)+k-1)/k);
    }
    std::cout << 1+ans << std::endl;
}


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

using namespace std;

map<string, int> cnt;

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

    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        cnt[s]++;
    }
    int mx = 0;
    vector<string> ans;
    for (auto it : cnt) {
        if (mx < it.second) {
            ans.clear();
            ans.push_back(it.first);
            mx = it.second;
        }
        else if (mx == it.second) {
            ans.push_back(it.first);
        }
    }
    for (auto s : ans) cout << s << '\n';
}

Measured memory_bytes: 25712
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int a = sc.nextInt();
		int j = h % a;
		if (j == 0) {
			System.out.println(h / a);
		} else {
			System.out.println(h / a + 1);
		}

	}

}

Measured memory_bytes: 22736
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main() {
    int N; cin >> N;
    int h[110];
    for (int i = 0; i < N; ++i) cin >> h[i];
    int res = 0;
    while(1) {
        if (*max_element(h, h+N) == 0) break;
        int i = 0;
        while(i < N) {
            if (h[i] == 0) {
                ++i;
                continue;
            }
            ++res;
            while(h[i] > 0) {
                --h[i];
                ++i;
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
s1 = set()
s2 = set()

for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        s1.add(b)
    if b == N:
        s2.add(a)

if len(s1.intersection(s2)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 18892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,a[21][21];
ll dp[(1<<21)];
int x[21];
int main(){
	cin>>n;
	rep(i,n){
		rep(j,n){
			cin>>a[i][j];
			x[i] += a[i][j]*(1<<j);
		}
	}
	dp[0] = 1;
	rep(i,n){
		for(int j=0;j<(1<<n);j++){
			if(__builtin_popcount(j) != i) continue;
			for(int xx=0;xx<n;xx++){
				if(a[i][xx] && !((j>>xx)&1)){
					dp[j+(1<<xx)]+=dp[j];
					if(dp[j+(1<<xx)]>=mod)dp[j+(1<<xx)]-=mod;
				}
			}
		}
	}
	cout<<dp[(1<<n)-1]%mod<<endl;
}

Measured memory_bytes: 16768
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    if a[0] + a[1]>=10:
        print("error")
    else:
        print(a[0]+a[1])



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

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

    for(int i=0; i<s.size(); i++) {
        int a = int(s[i]);
        a += n;
        if( a >= 91)  a -= 26;
        cout << char(a);
    }

    cout << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, A[100000], B[100000], C[100000];
    ll count[100001] = {0};
    cin >> N;
    REP(i, N) cin >> A[i]; sort(A, A + N, greater<int>());
    REP(i, N) cin >> B[i]; sort(B, B + N, greater<int>());
    REP(i, N) cin >> C[i]; sort(C, C + N, greater<int>());

    int j = 0;
    REP(i, N) {
        while (j < N && A[j] >= B[i]) j++;
        if (j >= N) continue;
        count[i] = N - j;
    }

    RFOR(i, N, 0) {
        if (count[i] != 0 && count[i - 1] == 0) break;
        else count[i - 1] += count[i];
    }

    j = 0;
    ll ans = 0;
    REP(i, N) {
        while (j < N && B[j] >= C[i]) j++;
        if (j >= N) continue;
        ans += count[j];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <array>

using namespace std;

static void inputArray(int A[], int num) {
  for (int i = 0; i < num; i++) {
    cin >> A[i]; 
  }
}

static bool binarySearch(int S[], int n, int search) {
  int left = 0;
  int right = n;
  int mid = 0;
  while (left < right) {
    mid = (left + right) / 2;
    if (search == S[mid]) {
      return true;
    } else if (search < S[mid]) {
      left = left;
      right = mid;
    } else {
      left = mid + 1;
      right = right;
    }      
  }
  return false;
}

int main() {
  int n, q;
  array<int, 100000> S;
  array<int, 50000> T;

  cin >> n;
  inputArray(S.data(), n);

  cin >> q;
  inputArray(T.data(), q);
  
  int found = 0;
  for (int i = 0; i < q; i++) {
    if (binarySearch(S.data(), n, T[i])) {
      found++;
    }
  }

  cout << found << endl;
  
  return 0;
}



Measured memory_bytes: 3696
s=input()

i=0 
j=len(s)-1
ans=0
while i<=j:
  if s[i]==s[j]:
    i+=1
    j-=1
  elif s[i]=="x":
    ans+=1
    i+=1
  elif s[j]=="x":
    ans+=1
    j-=1
  else:  break
if i <=j :
  print(-1)
  exit(0) 
else: print(ans)
  

  

Measured memory_bytes: 39664
#include<iostream>

using namespace std;

#define mod 100000

int main(){

	int w,h;
	int dp[4][101][101];  /*[p][w][h]*/
	int ans;

	while(1){

		cin>>w>>h;
		if(w==0&&h==0) break;

		for(int i=0;i<4;i++){
			for(int j=0;j<101;j++){
				for(int k=0;k<101;k++){
					dp[i][j][k]=0;
				}
			}
		}
		
		dp[1][1][0]=1;
		dp[0][0][1]=1;

		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				dp[3][j+1][i]=(dp[3][j+1][i]+dp[0][j][i])%mod;
				dp[0][j][i+1]=(dp[0][j][i+1]+dp[0][j][i]+dp[2][j][i])%mod;
				dp[2][j][i+1]=(dp[2][j][i+1]+dp[1][j][i])%mod;
				dp[1][j+1][i]=(dp[1][j+1][i]+dp[1][j][i]+dp[3][j][i])%mod;
			}
		}

		ans=0;
		for(int i=0;i<4;i++){
			ans=(ans+dp[i][w-1][h-1])%mod;
		}
		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 1320
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
long long N,M,a[100009][3],maxn=-(1LL<<60);
int main(){
	cin>>N>>M;
	for(int i=1;i<=N;i++){
		for(int j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	for(int i=0;i<8;i++){
		vector<long long>vec;
		for(int j=1;j<=N;j++){
			long long S=0;
			for(int k=0;k<3;k++){
				if((i/(1<<k))%2==0)
				{
					S+=a[j][k];
				}
				else{
					S-=a[j][k];
				}
			}
			vec.push_back(S);
		}
		sort(vec.begin(),vec.end());reverse(vec.begin(),vec.end());
		long long ans=0;
		for(int j=0;j<M;j++){
			ans+=vec[j];
		}
		maxn=max(maxn,ans);
	}
	cout<<maxn<<endl;
	return 0;
}

Measured memory_bytes: 256
def cin; gets.split.map(&:to_i) end
def cout(*x); puts x.join(" ") end

# exit if $0 != __FILE__

n = gets.to_i
s = gets.chop.chars

ws = s.reverse.inject([0]) {|m,c| m << ((c=='.') ? m.last+1 : m.last)}
bs = s.inject([0]) {|m,c| m << ((c=='#') ? m.last+1 : m.last)}
ws << ws.last
bs << bs.last

#p ws
#p bs

min = 10**18
[*(0..n)].each do |i|
  x = bs[i] + ws[n-i]
  #p x
  min = [min,x].min
end

puts min

Measured memory_bytes: 24700
#include <bits/stdc++.h>
#define MAX 1000000
#define MOD 1e9
#define pb push_back
#define pairs pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pairs>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define endl '\n'
using namespace std;
/* ----------------------------------------------------------------------------------- */

#define FastInput ios_base::sync_with_stdio(false), cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define REP(i, a, n) for (int i = a; i <= n; i++)
#define inputArray(a,n) rep(i, 0, n) cin >> a[i];
#define copyArray(a,temp,n) rep(i, 0, n) temp[i]=a[i];
#define printArray(a,n) rep(i, 0, n) cout << a[i] << " "; cout << endl;

/* ----------------------------------------------------------------------------------- */

#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)

#define dbgA2(A, n, m) {cout<<"--> "<<#A<<" = \n";rep(i, 0, n){rep(j, 0, n){cout<<A[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
#define dbgA(A, n) {cout<<" --> "<<#A<<" = (";rep(i, 0, n)cout<<A[i]<<" ";cout<<")\n";}
#define dbg(args...) {string sss(#args);sss+=',';cout<<" --> ";debugger::call(all(sss), args);cout<<"\n";}

/* ----------------------------------------------------------------------------------- */

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }

struct debugger {
	typedef string::iterator si;
	static void call(si it, si ed) {}
	template<typename T, typename ... aT>
	static void call(si it, si ed, T a, aT... rest) {
		string b;
		for(; *it!=','; ++it)
			if(*it!=' ')
				b+=*it;
		cout << b << "=" << a << " ";
		call(++it, ed, rest...);
	}
};

/* ----------------------------------------------------------------------------------- */
int A[3][3], b[10];
bool apear[3][3];


void solve() {
	int n;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> A[i][j];
		}
	}

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> b[i];

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			apear[i][j] = false;
			for (int k = 0; k < n; k++) {
				if(A[i][j] == b[k]) {
					apear[i][j] = true;
				}
			}
		}
	}

	string ans = "No";
	for (int i = 0; i < 3; i++) {
		if(apear[i][0] && apear[i][1] && apear[i][2])
			ans = "Yes";
	}
	for (int i = 0; i < 3; i++) {
		if(apear[0][i] && apear[1][i] && apear[2][i])
			ans = "Yes";
	}
	
	if(apear[0][0] && apear[1][1] && apear[2][2])
		ans = "Yes";
	if (apear[0][2] && apear[1][1] && apear[2][0])
		ans = "Yes";

	cout << ans << endl;
}

int main() {
	solve();

	// __test {
	// 	solve();
	// }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  int n;
  cin>>n;
  double c=0,x;
  string s;
  for(int i=0;i<n;i++){
    cin>>x>>s;
    if(s=="JPY") c+=x*1.0;
    else c+=x*380000.0;
  }
  cout<<fixed<<setprecision(10)<<c;
}

Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

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;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];

void Solve() {

	string s;
	cin >> s;
	for (size_t i = 0; i < s.size(); i++)
	{
		if (i == 4) {
			cout << " ";
		}
		cout << s[i];
	}
	cout << endl;
}


int main() {
	Solve();
	return 0;
}



Measured memory_bytes: 6400
import sys
input = sys.stdin.readline
import itertools

"""
(a_i+1,a_{i+1}] に x がある間は...使う。傾き-1
a_{i+1} -> a_{i+1} + 1 のところでがくっと下がる
そこからa_iまでは傾き0
""" 

N,M = map(int,input().split())
A = [int(x) for x in input().split()]
FROM = A[:-1]
TO = A[1:]

d_slope = [0] * (M+1) # 傾きの差分

"""
5,4,3,2,1,5,5,5,5
0,-1,-1,-1,-1,4,0,0,0
0,-1,0,0,0,0,5,-4,0,0
"""

for x,y in zip(FROM,TO):
    if y < x:
        y += M
    z = y - x
    if z == 1:
        continue
    d_slope[1+(x+1)%M] += -1
    d_slope[1+y%M] += z # 1回で行けたのがz回かかるようになる
    d_slope[1+(y+1)%M] += 1-z

slope = list(itertools.accumulate(d_slope))
S = sum(slope)
slope = [x - S//M for x in slope]
slope[0] = 0

# 1番をお気に入りにしたときのスコアを求める
cnt = 0
for x,y in zip(FROM,TO):
    if x < y:
        cnt += (y-x)
    else:
        cnt += y

answer = cnt - slope[1] + min(itertools.accumulate(slope[1:]))
print(answer)

Measured memory_bytes: 17500
n,m,c = (int(x) for x in input().split())
b = [int(i) for i in input().split()]
a = [0]*n
ans = 0
for i in range(n):
    a[i] = [int(i) for i in input().split()]

def check(a,b,c,m):
    value = c
    for j in range(m):
        value += a[j]*b[j]
    if value>0:
        return True
    else:
        return False

for i in range(n):
    if check(a[i],b,c,m):
        ans += 1
print(ans)


Measured memory_bytes: 3064
#include <algorithm>  
#include <iostream>  
#include <cstdlib>  
#include <cstring>  
#include <string>
#include <cstdio>  
#include <climits>
#include <cmath> 
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <sstream>
using namespace std;

#define  F  first
#define  S  second
#define  mp make_pair
#define  pb push_back
typedef long long int ll;
const int N = 2e5 + 5, mod = 1e9 + 7;
ll Arr[N], Brr[N], T[2 * N], n;

void updt(int idx)
{
	while (idx <= N)
	{
		T[idx] += 1;
		idx += (idx&-idx);
	}
}

ll qry(int idx)
{
	ll Ret = 0;
	while (idx>0)
	{
		Ret += T[idx];
		idx -= (idx&-idx);
	}
	return Ret;
}

bool Ok(ll x)
{
	ll now = 0, cur = n + 1, total = (n*(n + 1)) / 2;
	memset(T, 0, sizeof T);
	updt(cur);
	for (int i = 1; i <= n; i++)
	{
		if (Arr[i] >= x)++cur;
		else --cur;
		now += qry(cur);
		updt(cur);
		//printf("now : %d\n", now);
	}
	//printf("x : %d    now : %d\n", x, now);
	return 2 * now >= total;
}

int main()
{
#ifdef local
	freopen("in.txt", "r", stdin);
	//freopen("out.txt","w",stdout);
#endif

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	cin >> n;

	Brr[0] = 0;
	for (int i = 1; i <= n; i++)
	{
		cin >> Arr[i];
		Brr[i] = Arr[i];
	}
	sort(Brr + 1, Brr + n + 1);
	*Brr = unique(Brr + 1, Brr + n + 1) - Brr - 1;
	int lo = 1, hi = *Brr, mid, now = 0;
	while (lo <= hi)
	{
		mid = (lo + hi) >> 1;
		//cout<<mid<< "*\n";
		if (Ok(Brr[mid]))lo = mid + 1, now = mid;
		else hi = mid - 1;
	}
	cout << Brr[now] << "\n";










	return 0;
}

Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int>cost(n);
  for(int i=0;i<n;i++){
    cin >> cost[i];
  }
  vector<int>dp(n,INT_MAX);
  dp[0]=0;
  int m;
  for(int i=1;i<n;i++){
    m = i;
    for(int j=1;j<=k;j++){
      if(m>0){
        dp[i]=min(dp[i],dp[i-j]+abs(cost[i]-cost[i-j]));
        m--;
      }
      else{
        break;
      }
    }
  }
  /*for(int i=0;i<n;i++){
    cout << dp[i] << " ";
  }*/
  cout << dp[n-1];
  return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {


    public static void main(String[] args) throws IOException {

        ArrayList<Integer> x_list = new ArrayList<>();
        ArrayList<Integer> y_list = new ArrayList<>();

        int x;
        int y;

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        do {
            String[] line = br.readLine().split(" ");
            x = Integer.parseInt(line[0]);
            y = Integer.parseInt(line[1]);

            if (x == 0 && y == 0) {
                break;
            }

            x_list.add(x);
            y_list.add(y);

        } while (x != 0 || y != 0);

        for (int n = 0; n < x_list.size(); n++) {
            for (int a = 0; a < x_list.get(n); a++) {

                for (int b = 0; b < y_list.get(n); b++) {
                    System.out.printf("#");
                }

                System.out.println();
            }

            System.out.println();
        }

    }

}

Measured memory_bytes: 57936
import fractions

N, P = [int(x) for x in input().strip().split(" ")]

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        c = 0
        while n % i == 0:
            n /= i
            c+=1
        if c!=0:
            table.append((i,c))
        i += 1
    if n > 1:
        table.append((int(n), 1))
    return table



def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

xx = prime_decomposition(fractions.gcd(N, P))
print(len(xx) + 1)


Measured memory_bytes: 66156