akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vs = vector<string>;
using vp = vector<pii>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(), (x).end()
#define each(a, x) for (auto&& a : (x))
#define _overload3(_1, _2, _3, name, ...) name
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) for (ll i = (a); i < (n); ++i)
#define rep(...) _overload3(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
template<typename T> inline void print(const T& x) {cout << x << "\n";}
template<typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template<typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
struct Init {Init() {cin.tie(nullptr); ios::sync_with_stdio(false);}} init;

int main() {
    string S;
    cin >> S;
    if (S == "RRR"s) print(3);
    else if (S == "SRR"s) print(2);
    else if (S == "RRS"s) print(2);
    else if (S == "SSS"s) print(0);
    else print(1);
}

Measured memory_bytes: 3608
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
a = [arr[n - i - 1] for i in range(n) if (i + 1) % 2 == 1]
b = [arr[n - i - 1] for i in range(n) if (i + 1) % 2 == 0]
print(sum(a) - sum(b))

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include<math.h>
#include <cstring>
#include <algorithm>
using namespace std;


int main()
{	int x,a,b;
	scanf("%d%d%d",&x,&a,&b);
	printf("%d\n",(x-a)%b);
	
	return 0;
}

Measured memory_bytes: 256
n=int(input())
t,a=map(int,input().split())
arr=list(map(int,input().split()))
ans=10**18
ans1=-1
for i in range(len(arr)):
    val=t-(arr[i]*.006)
    if(abs(val-a)<ans):
        ans=abs(val-a)
        ans1=i
print(ans1+1)

Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
	char a[4],s='\0',k='\0';
	gets(a);
	s=a[0];
	for(int i=1;i<4;i++)
	{
		if(a[i]!=s && k=='\0')  
			k=a[i];
		else if(a[i]!=s && a[i]!=k)
		{
			printf("No");
			return 0;
		} 
			 		
	} 
	if(k=='\0')
	{
		printf("No");
	}
		
	else
	{
		printf("Yes");
	}	
		
}


Measured memory_bytes: 128
N = int(input())
d = N % 10
if (d == 2)|(d == 4)|(d == 5)|(d == 7)|(d == 9) :
    print('hon')
elif (d == 0)|(d == 1)|(d == 6)|(d == 8) :
    print('pon')
else:
    print('bon')

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

int n;
long long mod = 1e9 + 7;
long long calc(vector<int> &v, int idx, long long acc) {
  if (idx == n) {
    return acc;
  }
  return calc(v, idx + 1, (acc * (v[idx] - idx)) % mod);
}
int main() {
  cin>>n;
  int a[n];
  for (int i=0; i<n; i++) cin>>a[i];
  vector<int> cnt(n);
  cnt[0] = n;
  int prev = 1;
  int seq = 1;
  for (int i=1; i<n; i++) {
    cnt[i] = cnt[i-1];
    if (a[i] - prev > 1) {
      prev += 2;
      if (seq % 2 == 0) {
        --cnt[i];
      }
      seq = 1;
    } else {
      ++seq;
      if (seq % 2 == 1) {
        --cnt[i];
      }
    }
  }

  reverse(cnt.begin(), cnt.end());
  cout<<calc(cnt, 0, 1)<<endl;
}

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

int main() {
  int n, a, b, c, m = 1000000000;
  cin >> n >> a >> b >> c;
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  rep(i, pow(4, n)){
    int ta = 0, tb = 0, tc = 0, tm = 0, tmp = i;
    rep(j, n){
      if(tmp % 4 == 1){
        if(ta != 0) tm += 10;
        ta += v[j];
      }
      else if(tmp % 4 == 2){
        if(tb != 0) tm += 10;
        tb += v[j];
      }
      else if(tmp % 4 == 3){
        if(tc != 0) tm += 10;
        tc += v[j];
      }
      tmp /= 4;
    }
    if(ta == 0 || tb == 0 || tc == 0) continue;
    else{
      tm += abs(ta - a) + abs(tb - b) + abs(tc - c);
      m = min(m, tm);
    }
  }
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = Integer.parseInt(scanner.nextLine());
		
        String[] array = scanner.nextLine().split(" ");
        scanner.close();
 
        String[] arrayB = array.clone();
        String[] arrayS = array.clone();
        
        BubbleSort(arrayB, n);
        SelectionSort(arrayS, n);
        
        //BubbleSort printing
        System.out.print(arrayB[0]);
        for (int i = 1; i < n; i++)
            System.out.print(" " +arrayB[i]);
        System.out.println();
        System.out.println("Stable");
        
        //SelectionSort printing
        System.out.print(arrayS[0]);
        for (int i = 1; i < n; i++)
            System.out.print(" " +arrayS[i]);
        System.out.println();
         
        if (isStable(arrayB, arrayS, n))
            System.out.println("Stable");
        else
            System.out.println("Not stable");
	}
	
	
	public static void BubbleSort(String[] a, int n){
		String key = "";
		int j = 1000;
		for (int i = 0; i < n; i++) {
			for (j = n-1; j>i; j--) {
				if (a[j].charAt(1) < a[j-1].charAt(1)){
					key = a[j];
					a[j] = a[j-1];
					a[j-1] = key;
				}		
			}
		}			
	}
	
	private static void SelectionSort(String[] a, int n){
		String key = "";
		int mini = 0;
		for (int i = 0; i < n; i++) {
			mini = i;
			for (int j = i; j < n; j++) {
				if (a[j].charAt(1) < a[mini].charAt(1))
					mini = j;
			}
			if (i != mini){
				key = a[i];
				a[i] = a[mini];
				a[mini] = key;
			}
		}	
	}
	private static boolean isStable(String[] a, String[] b, int n){
		for (int i = 0; i < n; i++)
            if (a[i].charAt(0) != b[i].charAt(0))
                return false;
        return true;
    }
	
}



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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	int N;
	cin >>N;
	vector<int> a(N, 0);
	Rep0(i, N)
		cin >>a.at(i);
	//Rep0(i, N) {
	//	int AA=A.at(i);
	vector<int> B(32, 0);
	Rep0(i, N) {
		int A=a.at(i);
		Rep0(i, 32) {
		//for (int i=31; i>=0; i--) {
			B.at(i)+=A%2;
			A/=2;
		}
	}
	Rep0(i, N) {
		int A=a.at(i);
		int S=0;
		int I=1;
		for (int i=0; i<32; i++) {
			S +=I*((A+B.at(i))%2);
			A/=2;
			I*=2;
		}
		cout <<S <<endl;
	}
	return 0;
}



Measured memory_bytes: 3976
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int main(void){
	int n;
	scanf("%d",&n);
	char S[n][11];
	for(int i=0;i<n;i++)scanf("%s",S[i]);
	int moto=0;
	int headB=0,tailA=0,ryouhou=0;
	for(int i=0;i<n;i++){
		int l = strlen(S[i]);
		if(S[i][0]=='B'){
			if(S[i][l-1]=='A')ryouhou++;
			else headB++;
		}else if(S[i][l-1]=='A')tailA++;
		for(int j=0;j<l-1;j++){
			if(S[i][j]=='A' && S[i][j+1]=='B')moto++;
		}
	}
	int ans=moto;
	if(ryouhou==0)	ans+=MIN(headB,tailA);
	else if(headB+tailA>0)ans+=ryouhou+MIN(headB,tailA);
	else ans+=ryouhou-1;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{ int n,found=0;
  cin>>n;
  while(n>0)
  {
      int rem=n%10;
      if(rem==7)
      {

          found=1;break;
      }

      n=n/10;

  }

 if(found==1)
 {cout<<"Yes";}
 else
 {cout<<"No";}
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
	char a, b;
	cin >> a >> b;
	int count = 0;
	if (a == '9') {
		count++;
	}
	if (b == '9') {
		count++;
	}
	if (count > 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec (N);
  for(int i = 0;i < N;i++){
    cin >> vec.at(i);
  }
  
  int next = 1;
  int count = 0;
  while(next != 2){
  next = vec.at(next-1);
  count++;
  if(count > N){
    cout << "-1" << endl;
    return 0;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define len(x) (int) (x.size())
using namespace std;
typedef long long ll;

int main(){
    int n = 5, val = 0, ans = 0;
    for(int i = 0; i < n; i++) {
        cin >> val;
        if(val == 0) ans = i+1;
    }
    cout << ans << '\n';
    
    return 0;
}

Measured memory_bytes: 3620
S=int(input())
P=10**9+7
dp=[1]*2100 
dp[0]=0;dp[1]=0;dp[2]=0 
for i in range(3, 2001):
  for j in range(i+3, S+1):
    dp[j]+=dp[i]
    dp[j]%=P
print(dp[S])

Measured memory_bytes: 9144
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{

    ll i,j,k,n,x,y,m,c=0,mx;
    map<ll,ll>mp;
    vector<ll>v,h;
    cin>>n>>m;
    vector<ll>ob[n+5];
    for(i=0;i<n;i++)
    {
        cin>>x;
        h.push_back(x);
    }
    for(i=0;i<m;i++)
    {
        cin>>x>>y;
        ob[x].push_back(y);
        ob[y].push_back(x);
    }
    for(i=1;i<=n;i++)
    {
        ll f=0;

        if(ob[i].size()==0)
        {
            c++;
        }
        else
        {
            mx=h[i-1];
            for(j=0;j<ob[i].size();j++)
            {
                if(mx<=h[ob[i][j]-1])
                {
                    f=1;
                    break;
                }
            }
            if(f==0)
            {
                c++;
            }
        }


    }
     cout<<c<<endl;

    return 0;
}


Measured memory_bytes: 9820
n, m = map(int, input().split())
x = sorted(list(map(int, input().split()))) # 昇順に並び替え
diff = sorted([abs(e1 - e2) for e1, e2 in zip(x, [x[0]]+x[:-1])], reverse = True)

# 2個目以降はコストが大きいものから消えていくと考える
if n >= m:
    res = 0
else:
    res = sum(diff[n-1:])

print(res)

Measured memory_bytes: 13968
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int n;
int a[112345];
ll cnt[112345];

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  cin >> n;
  vector<pair<int, int>> v;
  for(int i = 1; i <= n; i++) cin >> a[i], v.emplace_back(a[i], i);
  sort(rbegin(v), rend(v));

  int mi = n;
  for(int i = 0; i < n; i++) {
    mi = min(mi, v[i].second);
    ll c = v[i].first - (i + 1 < n ? v[i+1].first : 0);
    cnt[mi] += c * (i + 1);
  }

  for(int i = 1; i <= n; i++) cout << cnt[i] << "\n";

  return 0;
}


Measured memory_bytes: 3188
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int cnt=0,i = 0, a, c, b, j, x, y, z, r, H, W;
	cin >> a >> b >> c;
	for (i = a; i < b+1; i++) {
		if (c%i == 0) {
			cnt++;
		}
	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 3164
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

var sc *bufio.Scanner

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	sc.Split(bufio.ScanWords)
	a := nextString()
	var c int
	for i := 0; i < len(a); i++ {
		if a[i] == '1' {
			c++
		}
	}
	fmt.Fprintf(writer, "%d", c)
}

func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main(){
  int a, b;
  cin>>a>>b;
  int x=b, tmp=1;
  while (x > 0){
    x/=10;
    tmp*=10;
  }
  b+=a*tmp;
  int z = sqrt(b);
  if (b%z==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

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

const int N = 1e5 + 10;
int deg[N], r, par[N], v, u, n, m;
vector<int> vec, g[N];
bool mark[N];

void dfs(int v){
	mark[v] = true;
	for (int u : g[v])
		if(!mark[u])
			dfs(u);
	vec.push_back(v);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		par[i] = -1;
		
	for (int i = 0; i < n + m - 1; i++){
		cin >> v >> u;
		v--;u--;
		
		g[v].push_back(u);
		deg[u]++;
	}
	
	for (int i = 0; i < n; i++)
		if(deg[i] == 0)
			r = i;
	
	dfs(r);
	reverse(vec.begin(), vec.end());
	
	for (int v : vec)
		for (int u : g[v])
			par[u] = v;
	
	for (int i = 0; i < n; i++){
		if(par[i] == -1)
			cout << 0 << '\n';
		else
			cout << par[i] + 1 << '\n';
	}
}

Measured memory_bytes: 12408
N = int(input())
INF = float('inf')
dp = [INF] * (N+1)
dp[0] = 0

for n in range(N + 1):
    power = 0
    while pow(6, power) <= n:
        dp[n] = min(dp[n], dp[n - pow(6, power)] + 1)
        power += 1

    power = 0
    while pow(9, power) <= n:
        dp[n] = min(dp[n], dp[n - pow(9, power)] + 1)
        power += 1

print(dp[N])


Measured memory_bytes: 3828
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
///////////////////////////////////////

int main() {
	int A, B;
	cin >> A >> B;
	if (A >= 13) {
		cout << B << endl;
	}
	else if (A >= 6 && A <= 12) {
		cout << B / 2 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  string a, b, c, r = "";

  cin >> a >> b >> c;

  r += toupper(a[0]);
  r += toupper(b[0]);
  r += toupper(c[0]);

  cout << r << "\n";

  return 0;
}


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

#define MAX 1024

int LCS[MAX][MAX];

int solve(string s1,string s2){
  for(int i=1;i<=s1.length();i++){
    for(int j=1;j<=s2.length();j++){
      if(s1[i-1]==s2[j-1])
	LCS[i][j]=LCS[i-1][j-1]+1;
      else
	LCS[i][j]=max(LCS[i][j-1],LCS[i-1][j]);
    }
  }
  return LCS[s1.length()][s2.length()];
}


int main(){
  string s1, s2;
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    for(int i=0;i<MAX;i++){
      for(int j=0;j<MAX;j++){
        LCS[i][j] = 0;
      }
    }
    cin>>s1>>s2;
    cout<<solve(s1,s2)<<endl;
    
  }

}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;

void solve() {
  string s;
  cin >> s;
  if(s == "A") cout << "T\n";
  if(s == "C") cout << "G\n";
  if(s == "G") cout << "C\n";
  if(s == "T") cout << "A\n";
}

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


Measured memory_bytes: 256
///IN THE NAME OF ALLAH
#include<bits/stdc++.h>
using namespace std;
int Arr[300];
int main(){
 int n;
 cin >> n;
 for(int i=0;i<n;i++)
     cin >> Arr[i];
 int mx=0;
 for(int i=0;i<n;i++)
  for(int j=0;j<n;j++)
   mx=max(mx,Arr[i]-Arr[j]);
 cout<<mx;
}




Measured memory_bytes: 256
#include<stdio.h>
int main() {
	long long int r, d, arr[11];
	scanf("%lld%lld%lld", &r, &d, &arr[0]);
	for (int i = 1; i < 11; i++) {
		arr[i] = r*arr[i - 1] - d;
		printf("%lld\n", arr[i]);
	}

}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define SZ(a) (int)(a).size()
typedef long long ll;

int n, m;
vector<vector<int>> al;
vector<bool> vis;
vector<bool> color;
int n0, n1, n2;
bool isbpt;

void dfs(int u, bool c) {
	if (vis[u]) {
		isbpt = isbpt && color[u] == c;
		return;
	}
	vis[u] = true;
	color[u] = c;
	for (auto v: al[u]) {
		dfs(v, !c);
	}
}

int main() {
	cin.sync_with_stdio(false);
	cin >> n >> m;
	al.assign(n, {});
	for (auto i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		al[u].push_back(v);
		al[v].push_back(u);
	}
	vis.assign(n, false);
	color.resize(n);
	for (auto u = 0; u < n; u++) {
		if (vis[u]) {
			continue;
		}
		if (al[u].empty()) {
			n0++;
			vis[u] = true;
			continue;
		}
		isbpt = true;
		dfs(u, false);
		if (isbpt) {
			n1++;
		}
		else {
			n2++;
		}
	}
	auto ans = (ll)n0*(2*n-n0)+(ll)n1*n1+(ll)(n1+n2)*(n1+n2);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 8704
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])

Measured memory_bytes: 38256
#include <iostream>

using namespace std;
int main() {
    int n;
    cin>>n;
    int list[100];
    for(int i=0;i<n;i++)cin>>list[i];

for(int i=n-1;i>=0;i--){
    if( i != n-1)cout<<" ";
    cout<<list[i];
    }
    cout<<endl;
    
    return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/

int main(){
cout<<fixed<<setprecision(10);

ll r,D,x2000;
  cin>>r>>D>>x2000;
   int ans;
    ans=r*x2000-D;
  cout<<ans<<endl;
  for(int i=0;i<9;i++){
   ans=ans*r-D;
    cout<<ans<<endl;
  }
  

}




Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[] counter = {0,0,0,0};
    while(sc.hasNext()) {
      String str = sc.next();
      String[] strArr = str.split(",");
      if (strArr[1].equals("A")) {
        counter[0]++;
      }
      else if (strArr[1].equals("B")) {
        counter[1]++;
      }
      else if (strArr[1].equals("AB")) {
        counter[2]++;
      }
      else {
        counter[3]++;
      }
    }
    for (int i = 0; i < 4; i++) {
      System.out.println(counter[i]);
    }
  }
}

Measured memory_bytes: 12000
#include<stdio.h>
#include<string.h>

int main(){
	int n,i,j,len;
	int score[2] = {0,0};
	char str[101],str2[101];
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %s",str,str2);
		if(strlen(str) <= strlen(str2)){
			len = strlen(str2);
		}else{
			len = strlen(str);
		}
		for(j=0;j<len;j++){
			if(str[j] == str2[j]){
				if(j == len-1){
					score[0] += 1;
					score[1] += 1;
					break;
				}else if(str[j] == '\n'){
					score[1] +=3;
					break;
				}else if(str2[j] == '\n'){
					score[0] +=3;
					break;
				}
			}
			if(str[j] > str2[j]){
				score[0] +=3;
				break;
			}
			if(str[j] < str2[j]){
				score[1] +=3;
				break;
			}
		}
	}
	printf("%d %d\n",score[0],score[1]);
	return 0;
}

Measured memory_bytes: 1024
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    A = [int(i) for i in readline().split()]

    now = A[0]
    pair = []
    mode = "up"
    for i in range(N-1):
        if mode == "up":
            if A[i+1] > A[i]:
                continue
            elif A[i+1] == A[i]:
                continue
            else:
                pair.append((now, A[i]))
                mode = "down"
        else:
            if A[i+1] < A[i]:
                continue
            elif A[i+1] == A[i]:
                continue
            else:
                now = A[i]
                mode = "up"

    if mode == "up":
        if now < A[-1]:
            pair.append((now, A[-1]))

    money = 1000
    stock = 0
    for buy, sell in pair:
        stock += money // buy
        money -= buy * stock
        money += sell * stock
        stock = 0

    print(money)


if __name__ == "__main__":
    main()


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

int x[11];
int r, D;
void solve()
{
	for(int i = 1; i < 11; i++)
		x[i] = r*x[i-1] - D;
	for(int i = 1; i < 11; i++)
		cout << x[i] << endl;
}
int main()
{
	cin >> r >> D >> x[0];
	solve();
	return 0;
}


Measured memory_bytes: 256
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# inputa = [int(n) for n in inputa]
# inputa.sort()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

print(a * b -a -b +1)

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int[] n = new int[s.length()];
		for(int i=0;i<s.length();i++) {
			n[i] =0;
		}
		int j=Integer.MIN_VALUE,k=Integer.MAX_VALUE;
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='R') {
				if(j<i) {
					k=Integer.MAX_VALUE;
					for(j=i;j<s.length();j++) {
						if(s.charAt(j)=='L') {
							break;
						}
					}
				}
				if(((j-i)%2) == 1) {
					n[j-1]++;
				}else {
					n[j]++;
				}
			}else {
				if(k>i) {
					for(k=i;k>=0;k--) {
						if(s.charAt(k)=='R') {
							break;
						}
					}
				}
				
				if(((i-k)%2) == 1) {
					n[k+1]++;
				}else {
					n[k]++;
				}
			}
		}
		for(int i=0;i<n.length;i++) {
			System.out.print(n[i] + " ");
		}
		System.out.println();
		
	}
}

Measured memory_bytes: 43028
#include <bits/stdc++.h> 
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define vbi vector<bool> 
#define mod 1000000007
#define INF 1000000000
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define sd second
#define ft first
#define ms(x,v) memset(x,v,sizeof x)
#define endl '\n'
#define cnl cout<<endl;
#define frr(i,b) for(ll i=0; i<b;i++)
#define fb(i,b) for(ll i=b-1; i>=0; i--)
#define pi  3.141592653589793238
ll i,j,k;
long long dp[3000+5][3000+5];
void solve(){
           string s,t; cin>>s>>t;
           for(i=0;i<(int)s.size();i++){
            for(j=0;j<(int)t.size();j++){
                 if(t[j]==s[i]){
                    dp[i+1][j+1]=dp[i][j]+1;
                 }
                 else{
                    dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
                 }
            }
           }
           ll n=(int)s.size();
           ll m=(int)t.size();
           vector<char> v;
           i=n;
           j=m;
           while(i>0 and j>0){
                if(dp[i][j]==dp[i-1][j]) i=i-1;
                else if(dp[i][j]==dp[i][j-1]) j=j-1;
                else if(dp[i][j]==(dp[i-1][j-1]+1)) v.pb(s[i-1]),i=i-1,j=j-1; 
            }
                reverse(v.begin(),v.end());
                for(i=0;i<(int)v.size();i++) cout<<v[i];
      }
 signed main(){
    solve();
    return 0;
  }

Measured memory_bytes: 70656
N = int(input())
ls = []
for i in range(N):
    ls.append(int(input()))
sum1 = sum(ls)
ls.sort()
ans = 0
if sum1 % 10 != 0:
    ans = sum1
else:
    for i in range(N):
        if (sum1-ls[i]) % 10 != 0:
            ans = sum1-ls[i]
            break
print(ans)

Measured memory_bytes: 8872
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int count = 0;
  if(s[0] == 'o') ++count;
  if(s[1] == 'o') ++count;
  if(s[2] == 'o') ++count;
  cout << 700+100*count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    int ac=0,wa=0,tle=0,re=0;
    for(int i=0;i<n;i++){
        cin>>s;
        if(s=="AC")
            ac++;
        else if(s=="WA")
            wa++;
        else if(s=="TLE")
            tle++;
        else 
            re++;
        }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
	int c[6];
	int i;
	int sum = 0;
	
	for (i = 0; i < 6; i++){
		scanf("%d", &c[i]);
	}
	
	c[1] *= 5;
	c[2] *= 10;
	c[3] *= 50;
	c[4] *= 100;
	c[5] *= 500;
	
	for (i = 0; i < 6; i++){
		sum += c[i];
	}
	
	if (sum >= 1000){
		printf("1\n");
	}
	else {
		printf("0\n");
	}
	
	return (0);
}

Measured memory_bytes: 584
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cost;};
//typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}
void printvi(vector<int> v){rep(i,0,v.size()){if(i)cout<<" ";cout<<v[i];}cout<<endl;}
void printvil(vector<int> v){rep(i,0,v.size()){cout<<v[i]<<endl;}}
void printvvi(vector<vector<int>> v){
    rep(i,0,v.size()){
        rep(j,0,v[i].size()){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
void printvstr(vector<string> v){
    rep(i,0,v.size()){
        cout<<v[i]<<endl;
    }
}

signed main (){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(((a<c and c<b) || (a>c and c>b))?"Yes":"No")<<endl;

}
/*
*/


Measured memory_bytes: 256
#include <stdio.h>
int main(){

  int h, w, a, b;

  while(1){
    scanf("%d%d", &a, &b);
    if( a == 0 && b == 0 ){
      break;
    }
    for( h = 0; h < a; h++ ){
      for( w = 0; w < b; w++ ){ 
        printf("#");
      }
      printf("\n");
    }
  printf("\n");
  }




  return 0;

}



Measured memory_bytes: 1916
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
	int *n;
	n = new int[3];
	for (int i = 0; i < 3; i++)
		cin >> n[i];
	sort(n, n + 3);
	printf("%d %d %d\n", n[0], n[1], n[2]);
	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
bool is_square(int n)
{
    for (int i = 0; i <= n; i++)
    {
        if (i * i == n)
        {
            return true;
        }
    }
    return false;
}
 
int main()
{
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int n = min(x, y);
    int ans = 0;
    if (a + b < 2 * c)
    {
        ans += n * (a + b);
    }
    else
    {
        ans += n * c * 2;
    }
    if (a < 2 * c)
    {
        ans += a * (x - n);
    }
    else
    {
        ans += 2 * c * (x - n);
    }
    if (b < 2 * c)
    {
        ans += b * (y - n);
    }
    else
    {
        ans += 2 * c * (y - n);
    }
    cout << ans << endl;
 
    return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vi vector<ll>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el printf("\n")
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
#define NIL -1
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);
int main()
{
	IOS;
    cout.precision(30);
    int n,m,a; cin >> n >> m; vector<int> A(n+1,1);
    for (int i=0;i<m;i++)
    {
        cin >> a;
        A[a]=0;
    }
    ll ans=1,mod=1e9+7,nbr=0;

    for (int i=2;i<=n;i++)
    {
        if (A[i]==1)
        {
            A[i]=(A[i-1]+A[i-2])%mod;
        }
    }

    cout << A[n] ;
    return 0;
}


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

int main() {
    int n;
    int ans = 0;
    cin >> n;
    for(int i = 1; i <= n; i++){
        string s = to_string(i);
        if(s.length() % 2 == 1)ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
 public static void main(String[] args){
   Scanner sc=new Scanner(System.in);
   
   int N=sc.nextInt();
   int K=sc.nextInt();
   int X=sc.nextInt();
   int Y=sc.nextInt();
   
   if(N<=K){
     System.out.println(N*X);
   }else if(N>K){
     System.out.println(K*X+(N-K)*Y);
   }
 }
}

Measured memory_bytes: 25300
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;
//|_
//g++ -std=c++1z temp.cpp
//./a.out

int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
    int m,n,i,j;
    while(1){
        cin>>n>>m;
        if(n==0&&m==0)break;
        vector<int> v(n,0),w(m,0);
        rep(i,n)cin>>v[i];
        rep(i,m)cin>>w[i];
        int anssum=INF,vsum=0,wsum=0;
        rep(i,n)vsum+=v[i];
        rep(i,m)wsum+=w[i];
        if(abs(vsum-wsum)%2==1){
            cout<<-1<<endl;
            continue;
        }
        int ansv=0,answ=0;
        int diff=(vsum-wsum)/2;
        bool ch=false;
        rep(i,v.size()){
            rep(j,w.size()){
                
                if(v[i]-w[j]==diff){
                    if(v[i]+w[j]<anssum){
                        ansv=v[i];
                        answ=w[j];
                        anssum=v[i]+w[j];
                        ch=true;
                    }
                }
            }
        }
        
        if(ch)cout<<ansv<<" "<<answ<<endl;
        else cout<<-1<<endl;
    }
    

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











Measured memory_bytes: 3124
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

    string S;
    READ(S);
    ll N=S.length();
    ll A[N+1]={0};
    FORI(i,0,N+1)
    {
        A[i]=-1;
    }
    FORI(i,0,N+1)
    {
        bool z=true;
        if(i<N && S[i]=='>')
        {
            z=false;
        }
        if (i-1>=0 && S[i-1]=='<')
        {
            z=false;
        }
        if (z)
        {
            A[i]=0;
        }
    }
    FORI(i,0,N)
    {
        if (A[i]!=-1 && S[i]=='<')
        {
            A[i+1]=A[i]+1;
        }
    }
    FORD(i,N,0)
    {
        if (S[i-1]=='>')
        {
            A[i-1]=max(A[i-1],A[i]+1);
        }
    }
    ll ans=0;
    FORI(i,0,N+1)
    {
        ans+=A[i];
    }
    cout<<ans<<endl;

    return 0;
}

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

int main(void){
  int n,t;
  cin>>n>>t;
  
  vector<int>time(n);
  
  for(int i=0;i<n;i++){
   cin>>time[i]; 
  }
  
  int dif;
  long long sum=t;
  for(int i=1;i<n;i++){
    dif=time[i]-time[i-1];
    
    if(dif<=t)sum+=dif;
    else sum+=t;
  }

  cout<<sum<<endl;
  return 0;
}

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


#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }



struct KMP {
    vector<long long> pat;
    vector<int> fail;

    // construct
    KMP(const vector<long long> &p) { init(p); }
    void init(const vector<long long> &p) {
        pat = p;
        int m = (int)pat.size();
        fail.assign(m+1, -1);
        for (int i = 0, j = -1; i < m; ++i) {
            while (j >= 0 && pat[i] != pat[j]) j = fail[j];
            fail[i+1] = ++j;
        }
    }

    // the period of S[0:i]
    int period(int i) { return i - fail[i]; }
    
    // the index i such that S[i:] has the exact prefix p
    vector<int> match(const vector<long long> &S) {
        int n = (int)S.size(), m = (int)pat.size();
        vector<int> res;
        for (int i = 0, k = 0; i < n; ++i) {
            while (k >= 0 && S[i] != pat[k]) k = fail[k];
            ++k;
            if (k >= m) res.push_back(i - m + 1), k = fail[k];
        }
        return res;
    }
};

int N;
vector<long long> a, b;

void solve() {
    vector<long long> da(N*2), db(N);
    for (int i = 0; i < N*2; ++i) {
        int j = i % N;
        int k = (i + 1) % N;
        da[i] = a[j] ^ a[k];
        if (i < N) db[i] = b[j] ^ b[k];
    }
    KMP kmp(db);
    auto v = kmp.match(da);
    for (auto k : v) {
        if (k < N) cout << k << " " << (a[k] ^ b[0]) << endl;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while (cin >> N) {
        a.resize(N); b.resize(N);
        for (int i = 0; i < N; ++i) cin >> a[i];
        for (int i = 0; i < N; ++i) cin >> b[i];
        solve();
    }
}


















Measured memory_bytes: 14580
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

int main() {
    int n, x, t;
    cin >> n >> x >> t;
    int cnt=1,ans=0;
    while(true) {
        ans+=t;
        if(n<=x*cnt) break;
        cnt++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3196
//https://atcoder.jp/contests/dp/tasks/dp_h
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
char mat[1001][1001];
#define MOD 1000000007
int dp[1001][1001];
int n,m;
void maxWay(){
    int i=1;
    for(;i<=n;++i){
        if(mat[i][1]=='.')
            dp[i][1]=1;
        else
            break;
    }
    //set left column to 0
    for(;i<=n;++i){
        dp[i][1]=0;
    }
    i=1;
    for(;i<=n;++i){
        if(mat[1][i]=='.')
            dp[1][i]=1;
        else
            break;
    }
    //set left row to 0
    for(;i<=n;++i){
        dp[1][i]=0;
    }

    

    for(int i=2;i<=n;++i){
        for(int j=2;j<=m;++j){
            if(mat[i][j]=='#'){
                dp[i][j]=0;
            }else{
                dp[i][j]=(dp[i-1][j]%MOD+dp[i][j-1]%MOD)%MOD;
            }
        }
    }
    // for(int i=1;i<=n;++i){
    //     for(int j=1;j<=m;++j){
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }

}

int main() {
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j){
            cin>>mat[i][j];
        }
    }
    maxWay();
    printf("%d\n",dp[n][m]);
    return 0;
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

int main()
{

    ll n;
    cin >> n;
    ll ans = -1, ans2=1;
    for(ll i = 1; i <= n; i++)
    {

        ll x = log2(i);
        if(ans<x)
        {

            ans=x;
            ans2=i;
        }
    }
    cout << ans2;
}


Measured memory_bytes: 256
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cout<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

int n,m,l=1,r=1,bp=INT_MAX,v=1;
vpint que;
map<pint,pint> f;

main(){
    cin>>n>>m;
    rep(i,m){
        int p,y;
        cin>>p>>y;
        que.pb(mp(p,y));
        f.insert(mp(mp(p,y),mp(p,0)));
    }
    for(auto& x:f){
        if(bp!=x.se.fi){
            bp=x.se.fi;
            v=1;
        }
        x.se.se=v;
        //cout<<x.se.fi<<' '<<x.se.se<<endl;
        v++;
    }
    for(int i=0;i<m;i++){
        //cout<<f[que[i]].se;
        printf("%06d%06d\n",f[que[i]].fi,f[que[i]].se);
    }
    //sysp;
}



Measured memory_bytes: 10864
from sys import stdin
import math
import fractions

n = int(stdin.readline().rstrip())

cnt = 0
for i in range(1, n+1):
    for j in range(i, n+1):
        for k in range(j, n+1):
            a = math.gcd(i, j)
            b = math.gcd(a, k) * 6
            if i == j and j == k:
                b = int(b/6)
            elif i == j or j == k or i == k:
                b = int(b/2)
            #print(str(i) + ' ' + str(j) + ' ' + str(k) + ' : ' + str(b))
            cnt += b

print(cnt)




Measured memory_bytes: 10484
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int x, a; cin >> x >> a;
	if (x < a) cout << 0;
	else cout << 10;

	return 0;
}

Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	if(n<105)cout<<0;
	else if(n<135)cout<<1;
	else if(n<165)cout<<2;
	else if(n<189)cout<<3;
	else if(n<195)cout<<4;
	else cout<<5;
	return 0;
}

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

//#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

int f(int Y, int M, int D) {
	int ret = 0;
	ret += ((Y - 1) / 3) * 10 * 20;
	ret += ((Y - 1) - (Y - 1) / 3)*(5 * 19 + 5 * 20);
	dump(ret);
	ret += Y % 3 ? M / 2 * 20 + (M - 1) / 2 * 19 : (M - 1) * 20;
	ret += D;
	return ret;
}

signed main() {
	int n; cin >> n;
	rep(i, 0, n) {
		int Y, M, D; cin >> Y >> M >> D;
		int ans = f(1000, 1, 1) - f(Y, M, D);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){

	int N,L;

	scanf("%d %d",&N,&L);

	int base = 0;
	for(int i = 1; i <= N; i++){

		base += L+(i-1);
	}

	int minimum = BIG_NUM;
	int ans = -1;

	for(int i = 1; i <= N; i++){

		int tmp = 0;
		for(int k = 1; k <= N; k++){
			if(k == i)continue;

			tmp += L+(k-1);
		}
		if(abs(base-tmp) < minimum){
			minimum = abs(base-tmp);
			ans = tmp;
		}
	}

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

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
#include<string.h>

int main(void){
	char input[1200];

	scanf("%[^\n]",input);

	//FILE *fp=fopen("output.txt","w");
	for(int i=0;i<strlen(input);i++){
		printf("%c",isupper(input[i])?tolower(input[i]):toupper(input[i]));
		//fprintf(fp,"%c",isupper(input[i])?tolower(input[i]):toupper(input[i]));
	}
	puts("");
	//fclose(fp);
	return 0;
}



Measured memory_bytes: 2044